Starting 18c, we can create a clone of PDB using ASM level mirror copy the diskgroup with a point in time recovery of the PDB database.
This will be really helpful when you want to clone the PDB in the same instance and a point-in-time database clone is a full copy of a specific database, not the underlying storage system. Only data files are copied with in the ASM instance. Other files are created, or referenced as required to create the clone.
To use this feature, your compatible.asm and compatible.rdbms must be set 18.0 or higher and the disk groups must be flex/extended disk groups only and also the filegroups are part of only diskgroup.
It works in phases
- Prepare Mirror Copy - This process involves creating the cloned files and linking them with the parent files. However, the data is not copied at this time; the copying is done during remirroring. Remirroring occurs during the prepare phase of rebalance, which is initiated as part of this step
- Split the Mirror - Create the PDB using mirror copy
- Rebalance - Copying of ASM extents to Mirror
The progress of the operation and status can be checked in V$ASM_DBCLONE_INFO under DBCLONE_STATUS (PREPARED, SPLIT COMPLETED etc.)
Mirror Copy
ALTER SESSION SET CONTAINER = pdb1; Session altered. SHOW CON_NAME CON_NAME ------------------------------ PDB1 ALTER PLUGGABLE DATABASE PREPARE MIRROR COPY pdb1_mirror; Pluggable database altered.Check in v$asm_dbclone_info view
SELECT * FROM V$ASM_DBCLONE_INFO; GROUP_NUMBER DBCLONE_NAME MIRRORCOPY_NAME DBCLONE_STATUS PARENT_DBNAME PARENT_FILEGROUP_NAME CON_ID ------------ ------------- ---------------- ---------------- ------------- ---------------------- --------- 1 DB_UNKNOWN PDB1_MIRROR PREPARED ORCL_PDB1 ORCL_PDB1
Split the Mirror copy and create clone
SHOW CON_NAME CON_NAME ------------------------------ CDB$ROOT CREATE PLUGGABLE DATABASE newpdb1 FROM pdb1 USING MIRROR COPY pdb1_mirror; Pluggable database created. ALTER SESSION SET CONTAINER = newpdb1; session altered. SHOW CON_NAME CON_NAME ------------------------------ NEWPDB1 Check the V$asm_dbclone_info to check the status of the SPLIT SELECT * FROM V$ASM_DBCLONE_INFO; GROUP_NUMBER DBCLONE_NAME MIRRORCOPY_NAME DBCLONE_STATUS PARENT_DBNAME PARENT_FILEGROUP_NAME CON_ID ------------ ------------- ---------------- ---------------- ------------- ---------------------- --------- 1 ORCL_NEWPDB1 PDB1_MIRROR SPLIT COMPLETED ORCL_PDB1 ORCL_PDB1 0
Drop the Mirror Copy
ALTER SESSION SET CONTAINER = pdb1; Session altered. ALTER PLUGGABLE DATABASE DROP MIRROR COPY pdb1_mirror; Pluggable database altered.
Rebalance the Data group
ALTER DISKGROUP data REBALANCE WAIT;
Now the diskgroup data holds the datafiles for PDB1 and NEWPDB1 also. This is will really help not to touch anything on PDB level or copying datafiles for pdb clone level if you have datafiles under ASM.
-Thanks
Suresh
Follow Me!!!