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

StepCommandRun OnContainer
1DBMS_PDB.DESCRIBESourceNon-CDB
2Copy XML fileOSFrom Source → Target
3CHECK_PLUG_COMPATIBILITYTargetCDB$ROOT
4CREATE PLUGGABLE DATABASETargetCDB$ROOT
5Open PDB restrictedTargetCDB$ROOT
6ALTER SESSION SET CONTAINERTargetNew PDB
7noncdb_to_pdb.sqlTargetNew PDB
8utlrp.sqlTargetNew 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)

MethodUse Case
noncdb_to_pdb.sqlMost common
Data PumpCross platform
Transportable TablespaceLarge DB migration
RMAN DuplicateMigration scenarios

Oracle DBA

Experienced OCM-certified Oracle Database Administrator with over 18 years of expertise in designing, implementing, and managing complex database solutions. My expertise spans performance optimization, security, and high-stakes solution implementation. Adept at managing complex environments with precision.

No Comments

    Leave a Message

    Your email address will not be published. All fields are mandatory. **