DBA Hub

📋Steps in this guide1/31

Mastering Oracle Multitenant Architecture (CDB & PDB)

Learn everything about Oracle Multitenant Architecture—CDBs, PDBs, benefits, real-world use cases, SQL examples, and tips for DBAs.

oracle configurationintermediate
by OracleDba
95 views
1

What Is Oracle Multitenant Architecture?

Imagine you’re managing 50 different Oracle databases , each running on its own OS, memory, storage, and patching cycles. That’s a nightmare, right? That’s what Oracle set out to solve with the Multitenant Architecture , a way to consolidate multiple databases (PDBs) inside a single Container Database (CDB) . It reduces overhead, simplifies patching, and makes your life easier as a DBA. This model became mandatory from Oracle 21c onwards , and even in Oracle 19c , you can create up to 3 PDBs without a license. Let me break it down for you:
2

Components of Oracle Multitenant Architecture

- CDB (Container Database) : The host database that contains everything. - PDB (Pluggable Database) : Independent databases inside the CDB, having their own schemas, users, and data. - CDB$ROOT : Stores Oracle-supplied metadata. - PDB$SEED : A read-only template used to create new PDBs. - Application Root (Optional) : For application containers in large-scale deployments.
3

Think of it like this:

> The CDB is your office building. Each PDB is a separate office suite. They share infrastructure like electricity (memory, processes), but each has its own tenants (data, users). The CDB is your office building. Each PDB is a separate office suite. They share infrastructure like electricity (memory, processes), but each has its own tenants (data, users).
4

Benefits of Multitenant Architecture

- Ease of Consolidation : Migrate multiple databases into one container. - Faster Patching : Patch once at the CDB level, impact all PDBs. - Cloning Simplicity : Duplicate PDBs in seconds. - Resource Efficiency : Save memory, CPU, and storage. - Security Isolation : Each PDB is logically isolated. Real-world fact : Companies like PayPal and Airbnb adopted multitenant early to manage hundreds of microservices-based data systems efficiently.
5

Creating a Container Database (CDB)

You can create a CDB using DBCA or SQL command-line.
6

SQL Example:

Code/Command (click line numbers to comment):

1
2
3
4
5
CREATE DATABASE cdb1
USER SYS IDENTIFIED BY Welcome123
USER SYSTEM IDENTIFIED BY Welcome123
ENABLE PLUGGABLE DATABASE
SEED FILE_NAME_CONVERT=('/u01/oradata/seed/', '/u01/oradata/pdb1/');
7

Verify CDB:

Code/Command (click line numbers to comment):

1
SELECT CDB FROM V$DATABASE;
8

Creating from PDB$SEED:

Code/Command (click line numbers to comment):

1
2
3
CREATE PLUGGABLE DATABASE pdb1
ADMIN USER pdbadmin IDENTIFIED BY Pdb@123
FILE_NAME_CONVERT = ('/pdbseed/', '/pdb1/');
9

Cloning an Existing PDB:

Code/Command (click line numbers to comment):

1
CREATE PLUGGABLE DATABASE pdb2 FROM pdb1;
10

Unplug and Plug into Another CDB:

Code/Command (click line numbers to comment):

1
2
ALTER PLUGGABLE DATABASE pdb1 UNPLUG INTO '/backup/pdb1.xml';
CREATE PLUGGABLE DATABASE pdb1 USING '/backup/pdb1.xml' COPY;
11

Opening and Closing PDBs

Code/Command (click line numbers to comment):

1
2
3
4
5
-- Open
ALTER PLUGGABLE DATABASE pdb1 OPEN;

-- Close
ALTER PLUGGABLE DATABASE pdb1 CLOSE IMMEDIATE;
12

Open All PDBs at Startup:

Code/Command (click line numbers to comment):

1
ALTER PLUGGABLE DATABASE ALL SAVE STATE;
13

Common Users vs Local Users

- Common Users : Exist in all containers. Start with C##. - Local Users : Exist in a specific PDB.
14

Example:

Code/Command (click line numbers to comment):

1
CREATE USER C##admin IDENTIFIED BY Welcome123 CONTAINER=ALL;
15

Roles and Privileges

You can assign roles to common or local users . Always use CONTAINER=ALL or CURRENT to define the scope.

Code/Command (click line numbers to comment):

1
GRANT DBA TO C##admin CONTAINER=ALL;
16

Backup and Recovery in Multitenant

Using RMAN , you can back up entire CDB or individual PDBs.
17

Backup entire CDB:

Code/Command (click line numbers to comment):

1
RMAN> BACKUP DATABASE;
18

PITR (Point-in-Time Recovery) for a PDB:

Real-time scenario : In one of my projects, a client accidentally dropped critical data in PDB. We restored just that PDB using PITR without affecting others, a huge win for multitenant!

Code/Command (click line numbers to comment):

1
RECOVER PLUGGABLE DATABASE pdb1 UNTIL TIME "TO_DATE('2024-04-01 12:00:00','YYYY-MM-DD HH24:MI:SS')";
19

Performance and Tuning

You can run AWR/ASH reports either at the CDB level or for individual PDBs.
20

Useful Views:

- V$PDBS - V$CONTAINERS - DBA_HIST_ACTIVE_SESS_HISTORY
21

Resource Management

You can control CPU and I/O for each PDB using Oracle Resource Manager .
22

Example:

Code/Command (click line numbers to comment):

1
2
3
4
5
6
EXEC DBMS_RESOURCE_MANAGER.CREATE_CDB_PLAN('CDB_PLAN');

EXEC DBMS_RESOURCE_MANAGER.CREATE_CDB_PLAN_DIRECTIVE(
  PLAN => 'CDB_PLAN',
  PDB_NAME => 'PDB1',
  SHARES => 10);
23

Use Case 1: Dev/Test Environment Cloning

You can clone PDBs instantly for development or testing without provisioning from scratch.
24

Use Case 2: SaaS Architecture

Companies running SaaS apps can deploy each customer in its own PDB, simplifying management and offering secure multi-tenancy.
25

Common Errors and Fixes

Error Reason Fix ORA-65011 Invalid PDB name Use correct naming ORA-65049 Status conflict Close and retry ORA-65144 Duplicate PDB Drop existing or rename
26

Licensing Details

- Single Tenant (1 PDB) is free in Oracle 19c . - More than 3 PDBs requires Enterprise Edition + Multitenant Option .
27

What’s New in Oracle 19c & 21c Multitenant

- 19c : Free up to 3 PDBs, Save State feature. - 21c : Auto-clone PDBs, Snapshot carousel, and improved hot cloning.
28

Best Practices

- Always use SAVE STATE for auto-start. - Set clear naming conventions. - Monitor PDB performance regularly. - Backup PDBs individually when needed. - Use ACLs and local roles for security isolation.
29

Industry Insights

- Gartner : Over 75% of Oracle database customers will run multitenant by 2026. - LinkedIn job listings for “Oracle Multitenant” have grown 120% over the last 2 years. - Oracle Cloud (OCI) runs thousands of CDBs in Exadata infrastructure for high efficiency.
30

Final Thoughts: Why You Should Learn Multitenant Now

If you’re an aspiring or working Oracle DBA, knowing the Multitenant Architecture isn’t just optional, it’s essential. As databases scale and systems become more complex, Oracle’s CDB-PDB model is the future of streamlined and secure database management. You’ve now got the full roadmap, the theory, real-world examples, code, errors, and enterprise use cases. Don’t just read and forget. Try setting up your own CDB and PDBs on a test VM or Oracle Cloud Free Tier, and see the power in action.
31

Conclusion: Why You Should Start Learning Oracle Multitenant Now

Understanding Oracle Multitenant Architecture is not just a skill, it’s a must-have for every modern DBA . With Oracle continuing to push Multitenant as the default architecture from version 12c onwards, and now becoming mandatory in 21c , you can’t afford to stay behind. Whether you’re managing a few databases or planning enterprise-level deployments, CDB/PDB knowledge will define your future readiness . At Learnomate Technologies , we take pride in offering the most practical, real-time, and in-depth Oracle DBA training, including advanced topics like Multitenant Architecture . Our hands-on sessions, expert trainers, and real-world use cases ensure you’re not just learning theory, but gaining industry-ready expertise . 👉 For deeper insights and technical tutorials, visit our YouTube channel : 🔗 www.youtube.com/@learnomate 👉 Explore our full course offerings and get in touch via our official website : 🔗 www.learnomate.org 👉 Follow me on LinkedIn for daily knowledge bombs, career tips, and student success stories: 🔗 Ankush Thavali – LinkedIn If you want to read more about different technologies , tools, and career-focused content, check out our blog page here: 🔗 https://learnomate.org/blogs/ The future is multitenant— get skilled, get certified, and get ahead . See you in the batch!

Comments (0)

Please to add comments

No comments yet. Be the first to comment!