Friday, May 8, 2020

Multitenant : Overview of Container Databases (CDB) and Pluggable Databases (PDB)

Overview


The multitenant option represents one of the biggest architectural changes in the history of the Oracle database. The option introduced the concepts of the Container Database (CDB) and Pluggable Database (PDB).

◉ Container Database (CDB): On the surface this seems very similar to a conventional Oracle database, as it contains most of the working parts you will be already familiar with (controlfiles, datafiles, undo, tempfiles, redo logs etc.). It also houses the data dictionary for those objects that are owned by the root container and those that are visible to all PDBs.

◉ Pluggable Database (PDB): Since the CDB contains most of the working parts for the database, the PDB only needs to contain information specific to itself. It does not need to worry about controlfiles, redo logs and undo etc. Instead it is just made up of datafiles and tempfiles to handle it's own objects. This includes it's own data dictionary, containing information about only those objects that are specific to the PDB. From Oracle 12.2 onward a PDB can, and should, have a local undo tablespace.

Oracle Database Tutorial and Material, Database Certification, Oracle Database Exam Prep

This split of the data dictionary between common objects, in the root container, and PDB-specific objects, in the PDB's data dictionary, is very important, because this separation is what gives the multitenant option its flexibility. From the perspective of the PDB, the data dictionary is the union of the root and PDB data dictionaries, so internally the PDB feels very much like a normal Oracle database. For example, the DBA_% and ALL_% views within the PDB appears the same as any non-CDB database.

Oracle Managed Files (OMF) and Multitenant


Oracle recommend the use of Oracle Managed Files (OMF) when using the multitenant architecture, as it simplifies a number of pieces of functionality. It seems the use of OMF is mandatory for some functionality, like the Application Containers functionality in Oracle 12.2.

Creating Pluggable Databases (PDBs)


Since the bulk of the working parts are already present in the root container, creating a new PDB is a comparatively quick and simple task. When creating a completely new PDP, the PDB is created as a copy of a seed PDB, so it only takes as long as the files take to copy.

Oracle Database Tutorial and Material, Database Certification, Oracle Database Exam Prep

Instead of creating a new PDB from the seed, you can clone an existing PDB.

Oracle Database Tutorial and Material, Database Certification, Oracle Database Exam Prep

It is also possible to create clones in a remote CDB.

Oracle Database Tutorial and Material, Database Certification, Oracle Database Exam Prep

Unpluging and Plugging in Pluggable Databases (PDBs)


One of the most powerful features of the multitenant option is the ability to unplug a PDB from a CDB and plug it back into another CDB.

Oracle Database Tutorial and Material, Database Certification, Oracle Database Exam Prep

Conversion of a non-CDB database to a pluggable database involves getting a description the non-CDB database and using this to plug it into a CDB as a new PDB.

Relocate a Pluggable Database (PDB)


From Oracle 12.2 onward it is possible to relocate a PDB, moving it from one CDB to another. This is significantly simpler than doing a conventional unplug/plugin.

Oracle Database Tutorial and Material, Database Certification, Oracle Database Exam Prep

Refreshable Pluggable Database (PDB)


From Oracle 12.2 onward it is possible to refresh a cloned PDB from the source PDB, provided it has only ever been opened in read-only mode.

Oracle Database Tutorial and Material, Database Certification, Oracle Database Exam Prep

Refreshable Pluggable Database (PDB) Switchover


From Oracle 18c onward it is possible to switchover a refreshable PDB.

Oracle Database Tutorial and Material, Database Certification, Oracle Database Exam Prep

Proxy Pluggable Database (PDB)


From Oracle 12.2 onward it is possible to create proxy PDB, which is a skeleton PDB that sends SQL across to a remote PDB to be processed. This allows you to have a local endpoint for a remote database.

Oracle Database Tutorial and Material, Database Certification, Oracle Database Exam Prep

Application Containers


Oracle 12.2 introduces the concept of application containers, which act like a mini-root container. They can be used to centralise shared configuration and applications, which are used by their dependent application PDBs.

Oracle Database Tutorial and Material, Database Certification, Oracle Database Exam Prep

Pluggable Database (PDB) Snapshot Carousel


From Oracle 18c onward it is possible to create automatically managed snapshots of a PDB, also know as a snapshot carousel.

Oracle Database Tutorial and Material, Database Certification, Oracle Database Exam Prep

Container Database (CDB) Fleet Management


From Oracle 18c onward it is possible to monitor multiple container databases centrally as a fleet.

Oracle Database Tutorial and Material, Database Certification, Oracle Database Exam Prep

Views


The introduction of the multitenant option brings with it an extra layer of data dictionary views, allowing reporting across the root container and the pluggable databases (PDBs). Ignoring editions for the moment, prior releases had the following hierarchy.

DBA_ : All objects in the database.
|
--ALL_ : Objects accessible by the current user, including those owned by the current user.
  |
  --USER_ : Objects owned by the current user.

With Oracle 12c, an extra layer is added to the hierarchy.

CDB_ : All objects in all containers * (root and all PDBs).
|
--DBA_ : All objects in the current container (root or PDB).
  |
  --ALL_ : Objects accessible by the current user in the current container (root or PDB), including those owned by the current user.
    |
    --USER_ : Objects owned by the current user in the current container (root or PDB).

The output of the CDB_ views is dependent on the container they are accessed from. When accessed from the root container, they do indeed present all the information from all the containers. When accessed from a PDB, they effectively act like the DBA_ views from within the container. This can be a little confusing at first.

Related Posts

0 comments:

Post a Comment