Oracle's Multitenant architecture allows a Container Database (CDB) to host multiple Pluggable Databases (PDBs), each acting as a fully independent Oracle database. One of the most common DBA tasks is provisioning a new PDB — and the fastest, cleanest way to do it is by cloning from PDB$SEED, the read-only template PDB that ships with every CDB.
In this guide, we walk through the entire process — from
verifying prerequisites to opening and saving the PDB's state across restarts.
What is PDB$SEED?
PDB$SEED is a special, read-only template PDB that Oracle
ships with every Container Database. It contains the minimal set of data files
and dictionary objects required to seed a new Pluggable Database. When you
create a PDB using the default method, Oracle copies PDB$SEED's data files to a
new location and bootstraps a fresh PDB from them.
Key characteristics of PDB$SEED:
• Always in READ ONLY mode — it can never be opened for writes
• CON_ID = 2 in every CDB (CDB$ROOT = 1, user PDBs start from 3)
• Patched automatically when you run datapatch on the CDB
• Serves as the template for CREATE PLUGGABLE DATABASE ... FROM PDB$SEED (the default)
Note: Never attempt to open PDB$SEED in READ WRITE mode. Oracle will reject it, and attempting workarounds can corrupt your CDB.
Step 1 -Verify Prerequisites
Before issuing the CREATE command, confirm your session is
connected to CDB$ROOT and that PDB$SEED is healthy.
1. Confirm you are in CDB$ROOT
Show CON_NAME
2. Confirm this is a CDB
SELECT NAME, CDB, CON_ID FROM V$DATABASE;
Note: If SHOW CON_NAME returns a PDB name rather than CDB$ROOT, switch back: ALTER SESSION SET CONTAINER = CDB$ROOT;
Step 2 - Create the Pluggable Database
Open the PDB in READ WRITE mode
ALTER PLUGGABLE DATABASE TESTPDB1 OPEN;
Verify the open mode
SELECT CON_ID, NAME, OPEN_MODE, RESTRICTED FROM V$PDBS WHERE NAME = 'PDB_NAME';
By default, PDBs return to MOUNTED state when the CDB is restarted. Use SAVE STATE to instruct Oracle to automatically re-open the PDB to its saved mode after every CDB startup.
Persist the open state across CDB restarts
ALTER PLUGGABLE DATABASE TESTPDB1 SAVE STATE;
Note: SAVE STATE is the equivalent of adding the PDB to a startup trigger. Always run it after opening a new PDB in production.
Step 5 - Post-Creation Tasks
-- Switch into the new PDB
ALTER SESSION SET CONTAINER = TESTPDB1;
-- Confirm context
SHOW CON_NAME;
-- Review tablespaces
SELECT TABLESPACE_NAME, STATUS, CONTENTS FROM DBA_TABLESPACES;
-- Create the application user
CREATE USER app_user IDENTIFIED BY "AppPassword#1"
DEFAULT TABLESPACE users
TEMPORARY TABLESPACE temp
QUOTA UNLIMITED ON users;
GRANT CONNECT, RESOURCE TO app_user;
-- Return to CDB root
ALTER SESSION SET CONTAINER = CDB$ROOT;
|
Error Code |
Cause |
Fix |
|
ORA-65012 |
PDB name already exists |
Choose a different name or
drop the existing PDB |
|
ORA-17537 |
Wrong file path |
Verify FILE_NAME_CONVERT
paths exist on the OS |
|
ORA-65016 |
FILE_NAME_CONVERT required |
Set DB_CREATE_FILE_DEST or
specify FILE_NAME_CONVERT |
|
ORA-01109 |
PDB not open |
Run ALTER PLUGGABLE
DATABASE pdb_name OPEN |
|
ORA-65040 |
Not in CDB root |
Run ALTER SESSION SET
CONTAINER = CDB$ROOT first |
• PDB$SEED is the read-only seed template — never open it in READ WRITE mode
• Always run from CDB$ROOT with SYSDBA privileges when creating PDBs
• FILE_NAME_CONVERT is mandatory unless OMF (DB_CREATE_FILE_DEST) is configured
• Newly created PDBs are in MOUNTED state — open them explicitly with ALTER PLUGGABLE DATABASE ... OPEN
• Always run SAVE STATE in production so PDBs survive CDB restarts automatically
• Each PDB shares the CDB's redo, undo, and TEMP — but owns its own data files.
Caution: Your use of any information or materials on this Blog is entirely at your own risk. It is provided for educational purposes only.
No comments:
Post a Comment