Multitenant Architecture - Oracle 12c Onwards

Several of our readers have suggested that we put information about Oracle 12c onwards and it's new "Multitenant" concept which is revolutionary instead of the traditional way but retaining many of the concepts in its previous versions, my idea is to introduce them as quickly as possible to Oracle Database with advanced concepts already created and managed for 20 years, let's get into the subject; CBD and PDB. Oracle 12c has made the big change in its architecture and has presented a new concept Container Database and Pluggable Database, here we are going to present you the clear and precise concept with our methodology in BLOCKS.

Overview and History

Oracle 12c Release 1 (12.1) in 2013 introduces the concept Multitenant for your star product Oracle Database 12c onwards. As many of you knows Oracle 11g opened many doors to those concepts as Performance Diagnostics, SQL Tuning, Oracle Grid Control and many other enhancements. Many of you perhaps know that 'g' stands for 'Grid' which offered supporting grid computing features such as automatic load balancing and after 12 version the letter has changed for 'c' stands for 'Cloud'. Multitenant help companies to consolidate databases into private or public clouds.

PDB, CDB and Root Concepts

What are PDB and CDB? Before to start with the definition of those new concepts I will contextualise in easy words what CDB contains, basically Oracle metadata, in other words, sys and system schemas. PDB contains user data; in other words, our appreciate customer data.

About Containers Database

Every CDB has the following containers:

Exactly one root

The root stores Oracle-supplied metadata and common users. An example of metadata is the source code for Oracle-supplied PL/SQL packages. A common user is a database user known in every container. The root container is named CDB$ROOT.

Exactly one seed PDB

The seed PDB is a system-supplied template that the CDB can use to create new PDBs. The seed PDB is named PDB$SEED. You cannot add or modify objects in PDB$SEED.

Zero or more user-created PDBs

A PDB is a user-created entity that contains the data and code required for a specific set of features. For example, a PDB can support a specific application, such as human resources or sales application. No PDBs exist at the creation of the CDB. You add PDBs based on your business requirements.

Picture: Original concept of – Jairo Suarez

Source information:

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.).

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 its objects.

If you have taken the picture in your mind about these concepts, then its time to move on! Click here to see step by step how to install Oracle Database 12c/18c.

How to Clone PDB's

This feature appears in 12.2 release onward, although Oracle announced this feature in 12.1 release version but it does not work, I remember this because I spent two days trying to resolve and unexpected error trying to duplicate one PDB for one of my customers. After further investigation and much stress because I don't find an answer, finally, I saw the light on the darkness, Oracle added the ability to create in 12.1 but did not work at all and then they put a patch set fix this up. OK said this let's go and play!

Remember: You can copy a source PDB from a CDB and plug the copy into the same CDB or into another CDB. See the image above and compare!


Before starting this small tutorial about how to, you should:

1. Ensure that you have enough disk space to hold a complete clone of the PDB.

if you want to display the biggest file sizes only, then run the following command:

find -type f -exec du -Sh {} + | sort -rh | head -n 5d -n 5

2. Install Oracle Database 12c.

3. Create one CDB with one PDB in it.

The environment used in the development of this tutorial is as follows:

ORACLE_HOME: /u01/app/oracle/product/12.1.0

TNS Listener port: 1521

Container databases:

SID: cdb1

SID: cdb2

Pluggable databases (in cdb1):



Keep track of changes

You prepare the source PDB to be cloned and the target new PDB to be created.

Setting the Source PDB to READ ONLY Mode

1. Use SQL*Plus to close the PDB that you want to clone.

. oraenv

[enter cdb1 at the prompt]

sqlplus / as sysdba

alter pluggable database pdb1 close immediate;

2. Open the PDB that you want to clone in READ ONLY mode.

alter pluggable database pdb1 open read only;


Creating a Directory for the New Clone PDB

1. Navigate to /stage or wherever you can find enough available space to store the data files for pdb1_clone.

cd /stage

2. Create a subdirectory called pdb1_clone under /stage.

Note: You may need to log in as root to create the subdirectory, and then change the owner to oracle and the group to oinstall.

mkdir pdb1_clone

Configuring OMF to the Directory of the Clone PDB

1. Use SQL*Plus to connect as sysdba and set the following parameter:

sqlplus / as sysdba alter system set db_create_file_dest='/stage/pdb1_clone';

Cloning the PDB within the CDB

Use SQL*Plus to clone the PDB within the same CDB.

1. Execute the following statement:

create pluggable database pdb1_clone from pdb1;

2. Open the new pdb.

alter pluggable database pdb1_clone open;

3. Connect to the new pdb.

connect system/oracle@localhost:1521/pdb1_clone;

4. Verify that you are connected to the new PDB:

show con_name

Setting the Source PDB Back to Open Mode

1. Connect to the root in the CDB.

connect / as sysdba

alter session set container=cdb$root;

2. Execute the following statement:

alter pluggable database pdb1 close immediate;

3. Open the source PDB.

alter pluggable database pdb1 open;

Resetting the Environment – In case to be necessary

Use the following scripts if you are using a development environment and you are testing with your container. Perform the following steps to reset your environment prior to repeating the activities.

1. Close the clone PDB.

alter pluggable database pdb1_clone close immediate;

2. Delete the clone PDB and its data files.

drop pluggable database pdb1_clone including datafiles;


To learn more about out pluggable databases, refer to additional OBEs in the Oracle Learning Library

Let us know what you think

We'd love to hear from you about your experience with collaboration features. Send us a smile, a frown, or your suggestions.

Also, please give us feedback on this learning guide, so we can provide content that's truly useful and helpful.


60 views0 comments
Orange Splash
Orange Splash