Subscribe

Share

Database, SQL and PL/SQL

Basics of the Multitenant Container Database

Consolidate multiple databases with Oracle Database 12c.

By Anita Mukundan

September/October 2014

Running multiple databases on modern enterprise servers can be an inefficient use of both hardware and human resources. The multitenant container database feature in Oracle Database 12c Release 1 consolidates data and code from multiple databases—without changing existing schemas or applications—to improve resource utilization, manageability, and data security.

This column focuses on container databases and presents sample questions similar to those that you might encounter in the Upgrade to Oracle Database 12c and Oracle Database 12c: Advanced Administration exams. You can earn the Oracle Database 12c Administrator Certified Professional certificate by successfully completing either exam.


The Oracle Multitenant Option

Over time, variations in hardware, operating systems, and Oracle Database versions can lead to increasing database maintenance costs. DBAs must schedule individual backups, patch individual databases, and implement different security strategies.

The Oracle Multitenant option introduced in Oracle Database 12c helps you consolidate databases into a standardized database version that is deployed on a shared cloud infrastructure. The option is supported by an architecture in which a host database called the container database (CDB) can hold multiple pluggable databases (PDBs). This option facilitates

  • Better resource utilization. Available resources—such as background processes, system global area (SGA), and Oracle metadata—can be shared.
  • Rapid cloning. Multiple clones of a pluggable database can be quickly created.
  • Rapid provisioning. On file systems that support the copy-on-write feature, provisioning can be done quickly.
  • Management of many as one. With Oracle Enterprise Manager, a CDB with many PDBs can be managed as a single database.
  • Agility. PDBs can be plugged or unplugged easily for patching, upgrade, or migration purposes.
  • Shared resource management. The Oracle Database Resource Manager feature supports the multitenant architecture, enabling a CDB-level plan to manage resources among PDBs.
  • Enhanced security. Data security is maintained at a granular level even in high-density consolidation cloud environments.

An existing database can be adopted, with no changes, as a PDB. The Oracle Multitenant option can be used with the Oracle Real Application Clusters and Oracle Active Data Guard options.

Which statement is true about a PDB that is created from a non-CDB?

a. The data stored in all schemas of the PDB is visible by default to all other PDBs connected
to the same CDB.

b. Applications that use the PDB require code modification to enable them to access the PDB.

c. A PDB can be cloned only within the CDB to which it is connected.

d. The data in a PDB is backed up automatically in accordance with the backup policies and
schedule defined at the CDB level.

The correct answer is D. The Oracle Multitenant option uses the managing-many-as-one concept for activities such as backup and patching.

Answer A is incorrect because although a CDB shares resources such as background processes, SGA, and Oracle metadata, each PDB maintains granular control over its data and applies its own security policies to data visibility. Answer B is incorrect because the Oracle Multitenant option allows any existing non-CDB to be converted to a PDB with no changes to the database or the applications that access it. Answer C is incorrect because PDBs can be cloned within the same CDB or from one CDB to another.

Which statements are true about the Oracle Multitenant option?

a. A PDB can be cloned across CDBs.

b. After a patch is applied at CDB level, the patch should then be applied to each PDB in the
CDB.

c. The Oracle Database Resource Manager feature plans defined at the CDB level can assign
different priorities to the applications supported by various PDBs within the same CDB.

d. PDBs in a CDB share background processes and shared memory but no Oracle metadata.

e. The Oracle Multitenant option can be used with Oracle Real Application Clusters but not
Oracle Active Data Guard.

Only options A and C are correct, because PDBs can be cloned within the same CDB, or from one CDB to another. The Oracle Database Resource Manager feature has been enhanced to allow a CDB-level plan to manage the distribution of resources between the PDBs plugged into that CDB.

Answer B is incorrect because the managing-many-as-one concept allows patching to be done at the CDB level, which automatically patches all the PDBs plugged into it. Answer D is incorrect because all PDBs plugged into a CDB share the Oracle metadata that is stored in the CDB. Answer E is incorrect because the Oracle Multitenant option is compatible with and complements both Oracle Real Application Clusters and Oracle Active Data Guard.


Multitenant Architecture

In the multitenant architecture, a container is a collection of schemas, objects, and related structures. A container appears to be a logically separate, independent database. Each container in a CDB has a unique ID and name.

Enterprise database consolidation leads to greater scalability and improved resource utilization.

A container is classified either as a PDB or root container (also called the root). The root is a collection of schemas, schema objects, and nonschema objects to which all PDBs belong. The root does not store any user data.

A CDB has a single set of background processes and SGA that is used by all PDBs plugged into that CDB. A database instance is associated with a single CDB. A database instance cannot be shared between a non-CDB and CDB.

Every CDB has the following containers:

  • One root container, called CDB$ROOT, that stores Oracle-supplied metadata and common users (database users known in every container belonging to that CDB).
  • One seed PDB, called PDB$SEED—a system-supplied template that the CDB can use to create new PDBs. The seed PDB cannot be modified.
  • Zero or more PDBs.

A PDB is a user-created entity containing a collection of schemas and schema objects that store the data and code required for an application. No PDBs exist when a CDB is first created. A PDB can be plugged into only one CDB at a time.

A CDB can have multiple PDBs plugged in at any given time, and each PDB exists in complete isolation from the other PDBs plugged into the same CDB. Each PDB retains granular control over its schemas and objects.

From the perspective of a user or application, the PDB appears as if it is a traditional non-CDB database. From the operating system perspective, the CDB is the database.

Which statements are true about a CDB?

a. A CDB cannot exist without a PDB.

b. A CDB can contain multiple seed PDBs.

c. A CDB can share a database instance with a non-CDB.

d. A CDB cannot exist without a root container.

e. A CDB can have PDBs that have a user with the same username across the PDBs.

The correct answers are D and E. The minimal contents of a CDB are the root container CDB$ROOT and PDB$SEED. Because PDBs exist in isolation from one another, users and objects with the same names can be stored within each PDB.

Answer A is incorrect because a CDB can contain zero PDBs. Answer B is incorrect because a CDB can have only a single seed PDB, which cannot be modified and exists as a template for the creation of new PDBs. Answer C is incorrect because although both a CDB and a non-CDB can exist on the same server, they function as independent entities because of their architectural differences. A CDB shares a set of background processes and SGA with its PDBs, but a non-CDB requires a nonsharable set of background processes and SGA.


Horizontal Partitioning of the Oracle Data Dictionary

Horizontal partitioning of the Oracle data dictionary is at the heart of the multitenant architecture. This is a conceptual partitioning, not a physical table partitioning.

The CDB$ROOT root container contains a set of tablespaces and their data files, which implement the data dictionary tables to hold the metadata only for the Oracle system. The root’s metadata describes each PDB that is plugged into it. This metadata for a PDB is deleted from the root when that PDB is unplugged. The root, therefore, can be considered a metadatabase only.

Each PDB has its own set of tablespaces and corresponding data files that implement the data dictionary tables to hold an application’s metadata, and a set of tablespaces that hold the application’s user-defined data.

The root differs significantly from a PDB in that it never holds any user-defined data. Both the root and the PDBs have distinct data dictionaries and can be the “focus” of a foreground process. Therefore a session, at every moment of its lifetime, has a uniquely defined current container that it can access.

Which statement explains how the root container, CDB$ROOT, differs from a PDB?

a. CDB$ROOT contains only the Oracle system metadata, whereas a PDB contains metadata
from the CDB into which it is plugged and application metadata.

b. CDB$ROOT contains both Oracle system metadata and application metadata, whereas a
PDB contains only user-defined data.

c. CDB$ROOT contains all the Oracle system metadata and a part of the application metadata,
whereas a PDB contains all application metadata along with the user-defined data for that
application.

d. CDB$ROOT contains only the Oracle system metadata, whereas a PDB contains all
application metadata and the user-defined data for that application.

The correct answer is D. The root contains metadata only for the Oracle system and is a metadatabase with no user-defined data. A PDB is typically created for an application and therefore contains that application’s metadata and user-defined data. PDBs access required Oracle system metadata from the CDB that they are plugged into.


Conclusion

Enterprise database consolidation leads to greater scalability and improved resource utilization, which reduce server and storage hardware costs while increasing application availability. The Oracle Database 12c multitenant architecture retains the separation of individual databases and requires no changes to applications, and it simplifies DBA tasks such as provisioning, patching, and upgrading.

Next Steps

 LEARN more about the Oracle Certification Program

 READ Inside OCP columns

 

Photography by Meric Dagli, Unsplash