Within Oracle’s multitenant architecture, cloning a PDB allows you to build a duplicate environment—perfect for testing, patching, or sandboxing—without touching the production system.

1. Setting the Stage: Preparing Your Environment

Before cloning, confirm that:

  • You’re inside the CDB’s root container (CDB$ROOT) or an application root, depending on where you want your new PDB housed

— Show the current container name
SHOW CON_NAME;
— Or query for more details
SELECT SYS_CONTEXT(‘USERENV’, ‘CON_NAME’) AS current_container FROM dual;

If you are not in the root and want to switch to the CDB root (CDB$ROOT):
ALTER SESSION SET CONTAINER = CDB$ROOT;

  • You possess the CREATE PLUGGABLE DATABASE privilege.

— Check if granted directly to your user
SELECT *
FROM dba_sys_privs
WHERE grantee = ‘YOUR_USERNAME’
  AND privilege = ‘CREATE PLUGGABLE DATABASE’;

— Check if granted via a role
SELECT *
FROM role_sys_privs
WHERE privilege = ‘CREATE PLUGGABLE DATABASE’
  AND role IN (SELECT granted_role FROM dba_role_privs WHERE grantee = ‘YOUR_USERNAME’);

  • The source PDB’s state allows cloning:

If the CDB is in ARCHIVELOG mode and using local undo, the source can remain open in READ WRITE—enabling hot cloning.
Otherwise, the source PDB must be open in READ ONLY.

2. Cloning the PDB

— Optional: view current open PDBs
SHOW PDBS;

— If needed, close and reopen in read-only mode
ALTER PLUGGABLE DATABASE pdb1 CLOSE IMMEDIATE;
ALTER PLUGGABLE DATABASE pdb1 OPEN READ ONLY;

— Create the clone (e.g., PDB2) from PDB1
CREATE PLUGGABLE DATABASE pdb2
     FROM pdb1
     FILE_NAME_CONVERT=(‘/u01/oradata/pdb1/’, ‘/u01/oradata/pdb2/’);

— Mount and open the new PDB
SHOW PDBS;
ALTER PLUGGABLE DATABASE pdb2 OPEN;

— Return the source PDB to its original open mode if changed
ALTER PLUGGABLE DATABASE pdb1 CLOSE IMMEDIATE;
ALTER PLUGGABLE DATABASE pdb1 OPEN;

This procedure clones the file structure, adjusting file paths using FILE_NAME_CONVERT, assigns a new name, and makes the duplicate available in the same CDB.

3. Expanding Horizons: Remote and Advanced Cloning

Remote Cloning via Database Link

You can also clone a PDB located in a remote CDB using a database link:
CREATE PLUGGABLE DATABASE pdb_clone
FROM pdb_source@remote_link
FILE_NAME_CONVERT=(‘src_path’, ‘dest_path’);

Ensure the database link is created in the target CDB, not the source, and that prerequisites like endianness alignment and character set compatibility are in place.

Cloning a PDB is a strategic technique that enables you to replicate environments quickly and safely. Whether you’re working within the same CDB or pulling from a remote source, Oracle offers flexible options with commands such as CREATE PLUGGABLE DATABASE … FROM, along with support for advanced scenarios like snapshots, refreshable clones, and proxy access.

Recommended Posts

Start typing and press Enter to search