Step-by-Step: Convert Non-CDB to PDB
Converting a Non-CDB database to a Pluggable Database (PDB) is a common modernization step when moving to the multitenant architecture introduced in Oracle Database 12c and later versions like Oracle Database 19c.
The strategic goal is to migrate the standalone database into a Container Database (CDB) as a PDB, enabling centralized management, consolidation, and simplified patching.
When converting a Non-CDB database into a PDB, two environments are involved:
- Source → the existing Non-CDB database
- Target → the Container Database (CDB) where the new PDB will be created
Non-CDB to PDB Conversion – Where Each Step Runs
| Step | Command | Run On | Container |
|---|---|---|---|
| 1 | DBMS_PDB.DESCRIBE | Source | Non-CDB |
| 2 | Copy XML file | OS | From Source → Target |
| 3 | CHECK_PLUG_COMPATIBILITY | Target | CDB$ROOT |
| 4 | CREATE PLUGGABLE DATABASE | Target | CDB$ROOT |
| 5 | Open PDB restricted | Target | CDB$ROOT |
| 6 | ALTER SESSION SET CONTAINER | Target | New PDB |
| 7 | noncdb_to_pdb.sql | Target | New PDB |
| 8 | utlrp.sql | Target | New PDB |
Step-by-Step With Exact Location
Step 1 — Generate XML Manifest
Run on the source Non-CDB database.
BEGIN
DBMS_PDB.DESCRIBE('/tmp/noncdb.xml');
END;
/
Location:
- Database → Source
- Type → Non-CDB
Step 2 — Copy XML File
Copy the manifest file to the target server.
Example:
scp /tmp/noncdb.xml oracle@targetserver:/tmp/
Location:
- OS level
- Source → Target
Step 3 — Check Compatibility
Run on the target CDB.
Connect to the root container.
sqlplus / as sysdba
Check container:
SHOW CON_NAME;
Expected:
CDB$ROOT
Run compatibility check:
SET SERVEROUTPUT ONDECLARE
compatible BOOLEAN;
BEGIN
compatible := DBMS_PDB.CHECK_PLUG_COMPATIBILITY(
pdb_descr_file => '/tmp/noncdb.xml',
pdb_name => 'NONCDBPDB');IF compatible THEN
DBMS_OUTPUT.PUT_LINE('Compatible');
END IF;
END;
/
Location:
- Database → Target
- Container → CDB$ROOT
Step 4 — Create the PDB
Run on the target CDB root.
CREATE PLUGGABLE DATABASE NONCDBPDB
USING '/tmp/noncdb.xml'
COPY
FILE_NAME_CONVERT =
('/u01/oradata/noncdb/',
'/u01/oradata/cdb1/noncdbpdb/');
Location:
- Database → Target
- Container → CDB$ROOT
Step 5 — Open PDB in Restricted Mode
ALTER PLUGGABLE DATABASE NONCDBPDB OPEN RESTRICTED;
Location:
- Database → Target
- Container → CDB$ROOT
Step 6 — Switch to the New PDB
ALTER SESSION SET CONTAINER = NONCDBPDB;
Location:
- Database → Target
- Container → New PDB
Step 7 — Run Conversion Script
@$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql
Location:
- Database → Target
- Container → New PDB
This converts the non-CDB data dictionary to PDB format.
Step 8 — Recompile Invalid Objects
@$ORACLE_HOME/rdbms/admin/utlrp.sql
Location:
- Database → Target
- Container → New PDB
Important Considerations
1. Character Set Must Match
Non-CDB and CDB should have compatible character sets.
2. Option and Component Matching
Installed components should match.
Check:
SELECT comp_name, version FROM dba_registry;
3. Time Zone Version
Mismatch can cause plug-in violations.
4. Undo Mode
Target CDB should use Local Undo Mode.
Alternative Methods (Oracle Supported)
| Method | Use Case |
|---|---|
| noncdb_to_pdb.sql | Most common |
| Data Pump | Cross platform |
| Transportable Tablespace | Large DB migration |
| RMAN Duplicate | Migration scenarios |
No Comments