How to Change the DBID of a Pluggable Database (PDB) in Oracle

In the Oracle Multitenant architecture, each Pluggable Database (PDB) has its own Database Identifier (DBID). This identifier is used internally by Oracle and by tools such as RMAN to uniquely identify a database.

Many Oracle DBAs assume that unplugging and plugging a PDB will automatically generate a new DBID. However, this is not always correct.

The PDB DBID is stored inside the datafiles, so Oracle will not change it unless new datafiles are created.

In this article, we will explain the correct way to generate a new DBID for a PDB using the cloning method.

What is DBID in Oracle

DBID stands for Database Identifier. It is a unique number assigned when a database is created.

The DBID is important for:

  • RMAN backup and recovery
  • Database identification
  • Catalog registration
  • Database cloning operations

You can check the DBID of pluggable databases using the following query.

SELECT con_id, name, dbid FROM v$pdbs;
Example output:
CON_ID NAME DBID
------ -------- ----------
3 PDB1 1234567890

Why You May Need to Change the PDB DBID

Changing the DBID of a PDB may be required in scenarios such as:

  • Creating a duplicate environment
  • Avoiding conflicts in backup environments
  • Database cloning
  • Testing environments

Since Oracle does not allow direct modification of DBID, the supported approach is creating a clone of the PDB, which automatically generates a new DBID.

Step 1: Connect to the Database

Connect to the Oracle database as SYSDBA.

sqlplus / as sysdba
-- Verify that you are connected to the root container.
SHOW CON_NAME;
-- If required, switch to the root container.
ALTER SESSION SET CONTAINER=CDB$ROOT;

Step 2: Check the Current DBID of the PDB

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

To generate a new DBID, create a clone of the existing PDB.

CREATE PLUGGABLE DATABASE PDB1_NEW FROM PDB1;

During this process Oracle creates new datafiles, which results in a new DBID for the cloned PDB.

Step 4: Open the New PDB

After the clone operation completes, open the new PDB.

ALTER PLUGGABLE DATABASE PDB1_NEW OPEN;

Step 5: Verify the New DBID

Check the DBID again to confirm that the cloned PDB has a different identifier.

SELECT con_id, name, dbid FROM v$pdbs;
-- Example output:
CON_ID NAME DBID
3 PDB1 1234567890
5 PDB1_NEW 9876543210

Step 6: (Optional) Remove the Old PDB

If the purpose of cloning was to generate a new DBID, the original PDB can be removed.

First close the PDB.

ALTER PLUGGABLE DATABASE PDB1 CLOSE IMMEDIATE;

Then drop it.

DROP PLUGGABLE DATABASE PDB1 INCLUDING DATAFILES;

Important Points to Remember

  • Oracle does not allow direct modification of the DBID
  • The DBID is stored inside the database datafiles
  • The DBID changes only when new datafiles are created
  • Cloning a PDB automatically generates a new DBID

Conclusion

Changing the DBID of a Pluggable Database is not done directly in Oracle. The recommended approach is to clone the PDB, which creates new datafiles and automatically assigns a new DBID.

Understanding this concept is important for DBAs working with Oracle Multitenant environments, especially when managing cloned databases, backup environments, and test systems.