<<Back to Oracle ASM Main Page
Pluggable Database Cloning With Oracle ASM Flex Disk Group
- Point-in-time database clones are supported only in Oracle ASM flex and extended disk groups.
- Point-in-time database clones are supported only with Oracle Database 18c, version 18.1 or higher.
- Point-in-time database clones require disk group compatibility attributes COMPATIBLE.ASM and COMPATIBLE.RDBMS be set to 18.0 or higher.
- The source database (parent) must be a pluggable database. The database clone (child) created is a pluggable database under the same container database.
The Cloning is performed in 2 Steps.
Preparing the Mirrored Copy
Splitting the Mirrored Copy and Creating the Database Clone.
Note: After preparing the Mirrored Copy if you don't want to proceed for cloning you can drop the Mirrored Copy. The drop action discards all the changes performed by the ALTER PLUGGABLE DATABASE PREPARE SQL command. Action also triggers a rebalance on the appropriate disk group.
- Preparing the Mirrored Copy
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> show pdbs
CON_NAME
------------------------------
CDB$ROOT
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB01 READ WRITE NO
SQL> alter session set container=PDB01;
Session altered.
SQL> ALTER PLUGGABLE DATABASE PREPARE MIRROR COPY PDB01_CLONE;
Pluggable database altered.
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB01 READ WRITE NO
SQL> alter session set container=PDB01;
Session altered.
SQL> ALTER PLUGGABLE DATABASE PREPARE MIRROR COPY PDB01_CLONE;
Pluggable database altered.
from ASM instance you can check the Prepare Status
SQL> SELECT * FROM V$ASM_DBCLONE_INFO;
SQL> SELECT * FROM V$ASM_DBCLONE_INFO;
GROUP_NUMBER DBCLONE_NAME MIRRORCOPY_NAME DBCLONE_ST PARENT_DBNAME PARENT_FILEGROU CON_ID
------------ --------------- --------------- ---------- --------------- --------------- ------
1 DB_UNKNOWN PDB01_CLONE PREPARING TST1T_PDB01 TST1T_PDB01 0
------------ --------------- --------------- ---------- --------------- --------------- ------
1 DB_UNKNOWN PDB01_CLONE PREPARING TST1T_PDB01 TST1T_PDB01 0
- Splitting the Mirrored Copy and Creating the Database Clone
SQL> SHOW CON_NAME
CON_NAME
------------------------------
PDB01
SQL> alter session set container=CDB$ROOT;
Session altered.
SQL> CREATE PLUGGABLE DATABASE PDB03 FROM PDB01 USING MIRROR COPY PDB01_CLONE ;
Pluggable database created.
If TDE is configured
In case if you have TDE you must specify the Keystore password KEYSTORE IDENTIFIED BY password clause
SQL> CREATE PLUGGABLE DATABASE PDB03 FROM PDB01 USING MIRROR COPY PDB01_CLONE KEYSTORE IDENTIFIED BY keystore_password;
Pluggable database created.
CON_NAME
------------------------------
PDB01
SQL> alter session set container=CDB$ROOT;
Session altered.
SQL> CREATE PLUGGABLE DATABASE PDB03 FROM PDB01 USING MIRROR COPY PDB01_CLONE ;
Pluggable database created.
If TDE is configured
In case if you have TDE you must specify the Keystore password KEYSTORE IDENTIFIED BY password clause
SQL> CREATE PLUGGABLE DATABASE PDB03 FROM PDB01 USING MIRROR COPY PDB01_CLONE KEYSTORE IDENTIFIED BY keystore_password;
Pluggable database created.
From ASM instance you can check the Prepare Status
SQL> SELECT * FROM V$ASM_DBCLONE_INFO;
GROUP_NUMBER DBCLONE_NAME MIRRORCOPY_NAME DBCLONE_STATUS PARENT_DBNAME PARENT_FILEGROU CON_ID
------------ --------------- --------------- --------------- --------------- --------------- ------
1 TST1T_PDB03 PDB01_CLONE SPLIT COMPLETED TST1T_PDB01 TST1T_PDB01 0
SQL> show pdbs;
SQL> SELECT * FROM V$ASM_DBCLONE_INFO;
GROUP_NUMBER DBCLONE_NAME MIRRORCOPY_NAME DBCLONE_STATUS PARENT_DBNAME PARENT_FILEGROU CON_ID
------------ --------------- --------------- --------------- --------------- --------------- ------
1 TST1T_PDB03 PDB01_CLONE SPLIT COMPLETED TST1T_PDB01 TST1T_PDB01 0
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB01 READ WRITE NO
5 PDB03 MOUNTED
SQL> alter session set container=PDB03;
Session altered.
SQL> alter pluggable database PDB03 open;
Pluggable database altered.
SQL> show pdbs;
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB01 READ WRITE NO
5 PDB03 MOUNTED
SQL> alter session set container=PDB03;
Session altered.
SQL> alter pluggable database PDB03 open;
Pluggable database altered.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
5 PDB03 READ WRITE NO
---------- ------------------------------ ---------- ----------
5 PDB03 READ WRITE NO
- Dropping the Prepared Mirror Copy
After preparing the mirrored copy if you don't want to proceed with cloning you can simply drop the mirror copy
SQL> alter session set container=PDB01;
SQL> ALTER PLUGGABLE DATABASE DROP MIRROR COPY PDB01_CLONE;
SQL> ALTER PLUGGABLE DATABASE DROP MIRROR COPY PDB01_CLONE;
Note: You can not drop the mirror copy once you have completed the cloning. If you attempt to drop the mirror copy you will receive the following error.
ORA-59024: dropping mirror copy 'PDB01_CLONE' in disk group 'DATA' failed as
the file split is complete
the file split is complete
Comments
Post a Comment