Search

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 ELPatoDBA.com – Jairo Suarez


Source information: https://docs.oracle.com/database/121/CNCPT/cdbovrvw.htm#CNCPT89235


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!




Pre-requisites

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