Steps to
Clone A Pluggable Database From Existing PDB
So, I had a
requirement for a customer where I had to clone a PDB from existing PDB on same
CDB . I followed the following steps to do this.
Step 1.
Put the PDB
in read only mode
SQL> select
name,open_mode from v$pdbs; NAME OPEN_MODE ------------------------------
---------- PDB$SEED READ ONLY DEV READ WRITE SQL> alter session set container=DEV;
Session altered.
SQL> select file_name from dba_data_files;
FILE_NAME -------------------------------------------------------------------------------- /u01/app/oracle/oradata/nonprod/dev/system01.dbf /u01/app/oracle/oradata/nonprod/dev/sysaux01.dbf /u01/app/oracle/oradata/nonprod/dev/users01.dbf
SQL> show con_name
CON_NAME ------------------------------ DEV
SQL> shu immediate; Pluggable Database closed.
SQL> startup open read only Pluggable Database opened. |
Step 2.
Connect to the CDB and initiate PDB clone:
Set Oracle
SID as CDB SID [oracle@server1]$export
ORACLE_SID=NONPROD [oracle@server1]$sqlplus
/ as sysdba SQL> show con_name
CON_NAME ------------------------------ CDB$ROOT -- Clone
pluggable SQL>
create pluggable database DEVCLONE from DEV
FILE_NAME_CONVERT=('/u01/app/oracle/oradata/nonprod/dev','/u01/app/oracle/oradata/nonprod/devclone'); Pluggable
database created. |
Step 3:
Start the
new cloned PDB In read write mode
SQL> select name,open_mode from v$pdbs;
NAME OPEN_MODE ------------------------------ ---------- PDB$SEED READ ONLY DEV READ ONLY DEVCLONE MOUNTED
SQL> alter session set CONTAINER=DEV;
Session altered.
SQL> shutdown immediate; Pluggable Database closed. SQL> startup Pluggable Database opened. SQL> show con_name DEV |
Step4:-
start the new cloned PDB( DEVCLONE)
SQL> alter session set container=DEVCLONE;
Session altered. SQL> SHU IMMEDIATE
SQL> startup Pluggable Database opened.
SQL> conn sys/syspassword@NONPROD as sysdba Connected. SQL> select name,open_mode from v$pdbs;
NAME OPEN_MODE ------------------------------ ---------- PDB$SEED READ ONLY DEV READ WRITE DEVCLONE READ WRITE |
No comments:
Post a Comment