Hot Cloning of a PDB in Oracle Database

With the release of Oracle 12c and later enhancements in Oracle 18c and 19c, hot cloning of a Pluggable Database (PDB) has become a powerful feature for DBAs. Hot cloning allows you to clone a PDB while it’s open in read/write mode, without needing to quiesce the source PDB.

This is especially useful for:

  • Development/Test provisioning
  • Application environment refresh
  • Backup/recovery strategy validation

Let’s walk through how to perform hot cloning in Oracle 19c.


Prerequisites

Before you begin, ensure the following:

  1. You’re using Oracle 18c or higher (we’re using 19c).
  2. Source PDB is in read/write mode.
  3. You have local undo mode enabled.
  4. You have the required CREATE PLUGGABLE DATABASE privilege.
  5. Target CDB (Container Database) has sufficient space.

🔧 Environment

ParameterValue
Source CDBCDB1
Source PDBPDB1
Target CDB (same)CDB1
New Cloned PDB NamePDB1_CLONE
Oracle Version19c (19.14 tested)

Step-by-Step: Hot Cloning PDB in Oracle 19c

Step 1: Connect to CDB as SYSDBA

sys@cdb1 as sysdba

Step 2: Open Source PDB in Read/Write Mode (if not already)

ALTER PLUGGABLE DATABASE pdb1 OPEN READ WRITE;

Step 3: Clone the PDB While It’s Open

CREATE PLUGGABLE DATABASE pdb1_clone 
FROM pdb1
FILE_NAME_CONVERT = ('/u01/app/oracle/oradata/CDB1/pdb1/',
'/u01/app/oracle/oradata/CDB1/pdb1_clone/');

Note1:

  • FILE_NAME_CONVERT ensures datafiles are copied to a new location.
  • This command hot clones PDB1 even though it’s in use.

Step 4: Open the Cloned PDB

ALTER PLUGGABLE DATABASE pdb1_clone OPEN;

Step 5: Optional – Save it in pdb$seed for future clones

If this PDB will be used for future template-based clones:

ALTER PLUGGABLE DATABASE pdb1_clone SAVE STATE;

Check the Cloning Result

Run:

SELECT pdb_name, status FROM dba_pdbs;

Notes & Best Practices

  • Ensure adequate storage before cloning.
  • Use DBMS_PDB.DESCRIBE if cloning across different CDBs.
  • Consider using refreshable clones for continuous syncs.
  • Hot cloning works only in local undo mode (UNDO_MODE = LOCAL in CDB$ROOT).

Check:

SELECT property_name, property_value 
FROM database_properties
WHERE property_name = 'LOCAL_UNDO_ENABLED';

Hot Clone Across CDBs

To hot clone across CDBs:

On source CDB:
BEGIN DBMS_PDB.DESCRIBE( pdb_descr_file => ‘/tmp/pdb1.xml’, pdb_name => ‘PDB1’); END; /

On target CDB:
REATE PLUGGABLE DATABASE pdb1_clone USING ‘/tmp/pdb1.xml’ FILE_NAME_CONVERT = (‘/CDB1/PDB1/’, ‘/CDB2/PDB1_CLONE/’) COPY;



Yorum bırakın