How to Change PDB DBID in Oracle Using the Clone Method
Learn how to change the DBID of a Pluggable Database (PDB) in Oracle using the cloning method. Step-by-step practical guide for Oracle DBAs.
In Oracle Multitenant architecture, every Pluggable Database (PDB) has a unique DBID (Database Identifier). Oracle and tools like RMAN use this identifier to uniquely identify a database.
Many DBAs think unplugging and plugging a PDB automatically generates a new DBID. However, this is not always true. The DBID is stored inside the database datafiles, so Oracle will not change it unless new datafiles are created.
The easiest way to generate a new DBID is to clone the PDB. During cloning, Oracle creates new datafiles and automatically assigns a new DBID.
This guide shows the exact steps.
Step 1: Connect to the Root Container
Connect to the database as SYSDBA and switch to the root container.
sqlplus / as sysdbaSHOW CON_NAME;ALTER SESSION SET CONTAINER = CDB$ROOT;
Step 2: Check the Current PDB DBID
First, check the DBID of the existing PDB.
SELECT con_id, name, dbid FROM v$pdbs;
Example output:
CON_ID NAME DBID
------ ----- ----------
3 PDB1 1234567890
Step 3: Clone the PDB
Next, create a clone of the PDB. Oracle will generate new datafiles during this process.
CREATE PLUGGABLE DATABASE PDB1_NEW FROM PDB1;
Because new datafiles are created, Oracle assigns a new DBID to the cloned PDB.
Step 4: Open the New PDB
After cloning completes, open the new PDB.
ALTER PLUGGABLE DATABASE PDB1_NEW OPEN;
Step 5: Verify the New DBID
Now check the DBID again.
SELECT con_id, name, dbid FROM v$pdbs;
Example output:
CON_ID NAME DBID
------ -------- ----------
3 PDB1 1234567890
5 PDB1_NEW 9876543210
The cloned PDB now has a different DBID.
Step 6: Remove the Old PDB (Optional)
If you only needed a new DBID, you can remove the old PDB.
Close the PDB first:
ALTER PLUGGABLE DATABASE PDB1 CLOSE IMMEDIATE;
Then drop it:
DROP PLUGGABLE DATABASE PDB1 INCLUDING DATAFILES;
Important Points
- Oracle does not allow direct DBID modification
- DBID is stored in database datafiles
- DBID changes only when new datafiles are created
- Cloning a PDB automatically generates a new DBID
Conclusion
Changing the DBID of a PDB is not possible directly in Oracle. Instead, you should clone the PDB. The cloning process creates new datafiles and automatically assigns a new DBID.
This method is commonly used in testing environments, database cloning, and backup conflict resolution.


