Overview

The multitenant architecture hosts many pluggable databases (PDBs) in one container database (CDB) instance. Each PDB looks like a complete database to its application but shares the instance’s memory, background processes and redo. Consolidation, fast provisioning and per-PDB administration are the goals. Since Oracle 21c the non-CDB architecture is no longer supported for new databases.

Core concepts

  • Containers: CDB$ROOT (common objects, dictionary metadata), PDB$SEED (template, read only), and PDBs (here FREEPDB1). CON_ID identifies them.
  • Common users (names start with C##) exist in all containers; local users exist in one PDB. Applications use local users in their PDB.
  • Services: connect to a PDB by service name (//host:1521/FREEPDB1).
  • Cloning: CREATE PLUGGABLE DATABASE new FROM existing makes a copy; with ARCHIVELOG and local undo it can be a hot clone of an open source PDB. Snapshot clones use storage cloning. Unplug/plug moves a PDB to another CDB; relocate moves it online.
  • Resource management (CDB plans), PDB-level ALTER SYSTEM for many parameters, lockdown profiles restrict what a PDB admin can do, and PDB-level backup and recovery with RMAN (oracle-rman-backup).
  • Limits by edition: MAX_PDBS is 18 in the Free container used here; check current licensing for the number of PDBs allowed per edition.

Worked example

Executed on the Free container (instance in ARCHIVELOG):

SELECT con_id, name, open_mode, ROUND(total_size/1024/1024) mb FROM v$pdbs ORDER BY con_id;
-- 2 PDB$SEED   READ ONLY    684
-- 3 FREEPDB1   READ WRITE  1025
 
CREATE PLUGGABLE DATABASE kbclone FROM freepdb1 FILE_NAME_CONVERT = ('/FREEPDB1/', '/KBCLONE/');
ALTER PLUGGABLE DATABASE kbclone OPEN;
 
ALTER SESSION SET CONTAINER = kbclone;
SELECT COUNT(*) FROM kb.orders;       -- 500000, the entire application schema came with it

Result: three PDB rows (KBCLONE 1,025 MB) and the clone contained all 500,000 rows. Without FILE_NAME_CONVERT the statement failed with ORA-65016: FILE_NAME_CONVERT must be specified, because DB_CREATE_FILE_DEST was not set; file names must be mapped when Oracle Managed Files are not configured.

Pitfalls and production notes

  • Remember the container when you connect; DDL in the root affects common objects, not your application.
  • AWR snapshots are taken in the root; reading them in a PDB needs PDB-level AWR (oracle-awr-ash).
  • Cloned PDBs inherit users, data and secrets; scrub test copies of sensitive data.
  • A PDB shares the instance’s CPU and memory; use resource plans so one PDB cannot starve the others.
  • Data Guard and backups operate at the CDB level (oracle-data-guard).

Practice questions

  1. What is the difference between a common user and a local user?
  2. What do you need for a hot clone of an open PDB?
  3. Why is the multitenant model useful for CI test environments?

References

  • Oracle Database Administrator’s Guide, Creating and Configuring a CDB; Managing PDBs

oracle-architecture · oracle-security · oracle-rman-backup · oracle-patching-upgrades