A CDB, in turn, can house zero or more pluggable databases (PDBs), each consisting of schemas and objects that function just like familiar “normal” (pre-Oracle 12c) databases from the viewpoint of applications or SQL IDEs.
Contents of CDBs and PDBs
In the Oracle container database model, the CDB contains most of the working components every Oracle DBA knows, e.g., controlfiles, datafiles, tempfiles, undo, redo logs, etc. The CDB also contains the data dictionary for objects owned by the root container and those visible to all PDBs in the CDB.
Since the CDB contains most of the key parts of the database, each PDB need only contain information that is specific to itself and its schemas and schema objects, like datafiles and tempfiles. A PDB also has its own data dictionary, which includes information about objects specific to that PDB. A PDB can also have its own local undo tablespace. Each PDB has a unique ID and name. To an Oracle Net client, a PDB looks like a separate database.
Besides PDBs, a CDB can also contain zero or more application containers. These are user-created CDB components that store data and metadata for one or more application backends.
Finally, by default every CDB has one root container (named CDB$ROOT) and one seed PDB container (named PDB$SEED). The former stores Oracle metadata and common users. The latter is a template used to create new PDBs.
Deprecation and desupport of non-CDB databases
Beginning with Oracle Database 12c, Oracle deprecated the non Oracle container database architecture, and desupported it in Oracle Database 21c. This means that the Oracle Universal Installer and DBCA can no longer be used to create non-CDB instances of Oracle databases.
Desupport also means that an upgrade to Oracle Database 21c includes a migration to the multitenant architecture. This can be a significant consideration as it can change your approach to database administration.
Benefits of Oracle container database architecture
Is a move to Oracle container database architecture worth the learning curve? Why not just continue to create distinct individual databases or virtual machines (VMs)?
The benefits of moving to the CDB architecture often outweigh the “pain of change” because it can streamline your use of database resources and save you considerable operational and administrative time and costs. Pluggable databases are also easy to move between CDBs, which can increase the agility of your DBA services.
Some specific benefits of the Oracle container database model include:
- The ability to consolidate code and data without changing existing schemas or applications.
- Consolidating databases means you can also consolidate IT infrastructure and utilize computing resources more efficiently.
- Consolidated IT infrastructure, in turn, can simplify monitoring and management of the database environment—including faster backups and patching. Performance tuning can also be easier with the Oracle container database model.
- Because PDBs look like non-multitenant databases to Oracle Net clients, changes for developers working with Oracle databases are often not dramatic. Developers may notice little difference connecting to a multitenant scenario except that the connection strings have a different format.
Pluggability in the Oracle container database model
One of the top advantages of the Oracle container database model or multitenant option is the ability to unplug a pluggable database (PDB) from one CDB and plug it into a different CDB. This makes it easy to move databases, and can also be used to patch and upgrade database versions. Basically, you just unplug the PDB, move it to the CDB you plan to upgrade, and it will be patched/upgraded automatically along with the CDB.
The Oracle multitenant model also allows you to relocate a PDB to a new CDB or application container even more easily than going the unplugging/plug-in route, with near-zero downtime. During relocation, the source PDB can be open in read/write mode and fully usable.
More about application containers
Along with the Oracle container database model comes the concept of application containers. Similar to a root CDB container, you can use an application container to centralize or “containerize” one or more applications, each consisting of shared configuration, metadata and objects. These are then used by the application PDBs within the application container.
Next steps
The Oracle container database architecture can seem confusing even to experienced DBAs. But it’s more intuitive than it sounds once you’ve had a chance to work with it. The advantages of multitenancy generally far offset the learning curve for many DBAs and their companies.
To speak with an Oracle expert about leveraging the Oracle container database model in your environment, contact Buda Consulting.