-----------------------------------------------------------------------
Multitenant: Clone a Local Pluggable Database (PDB)
-----------------------------------------------------------------------
SQL> show con_name
SQL> show con_id
SQL> select name,open_mode from v$pdbs order by name;
SQL> alter pluggable database PDB1 open;
else
alter pluggable database PDB1 close;
SQL> alter pluggable database pdb1 open read only;
---------------------------------------
Verify PDB1 Datafile location
---------------------------------------
select FILE_NAME from cdb_data_files where CON_ID=3;
-------------------------------------------------------------
-- Clone the PDB.
-- If you are not using OMF, convert the paths.
-------------------------------------------------------------
SQL> create pluggable database pdb2 from pdb1
FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb1/pdb1/',
'/u01/app/oracle/oradata/cdb1/pdb2/');
OR
----------------------------------------
-- In My Case,I'm using OMF
----------------------------------------
create pluggable database pdb2 from pdb1
FILE_NAME_CONVERT=('/u01/app/oracle/oradata/CDB1/260DCEBE98C33DD5E0530100007F3F93/datafile/o1_mf_system_c62fglyh_.dbf',
'/u01/app/oracle/oradata/CDB1/pdb2/datafile/system01.dbf',
'/u01/app/oracle/oradata/CDB1/260DCEBE98C33DD5E0530100007F3F93/datafile/o1_mf_sysaux_c62fgm20_.dbf',
'/u01/app/oracle/oradata/CDB1/pdb2/datafile/sysaux01.dbf',
'/u01/app/oracle/oradata/CDB1/260DCEBE98C33DD5E0530100007F3F93/datafile/o1_mf_users_c62fm10j_.dbf',
'/u01/app/oracle/oradata/CDB1/pdb2/datafile/users01.dbf',
'/u01/app/oracle/oradata/CDB1/260DCEBE98C33DD5E0530100007F3F93/datafile/o1_mf_slob_c62qjm9g_.dbf',
'/u01/app/oracle/oradata/CDB1/pdb2/datafile/slob01.dbf',
'/u01/app/oracle/oradata/CDB1/260DCEBE98C33DD5E0530100007F3F93/datafile/o1_mf_temp_c62fgm21_.dbf',
'/u01/app/oracle/oradata/CDB1/pdb2/datafile/temp01.dbf');
SQL> alter pluggable database pdb2 open;
SQL> select name ,open_mode from v$pdbs order by name;
SQL> alter pluggable database pdb1 close;
SQL> alter pluggable database pdb1 open;
---------------------------
-- Remove the Clone
----------------------------
SQL> alter pluggable database pdb2 close;
SQL> Drop pluggable database pdb2 including datafiles;
SQL> select name ,open_mode from v$pdbs order by name;
Multitenant: Clone a Local Pluggable Database (PDB)
-----------------------------------------------------------------------
SQL> show con_name
SQL> show con_id
SQL> select name,open_mode from v$pdbs order by name;
SQL> alter pluggable database PDB1 open;
else
alter pluggable database PDB1 close;
SQL> alter pluggable database pdb1 open read only;
---------------------------------------
Verify PDB1 Datafile location
---------------------------------------
select FILE_NAME from cdb_data_files where CON_ID=3;
-------------------------------------------------------------
-- Clone the PDB.
-- If you are not using OMF, convert the paths.
-------------------------------------------------------------
SQL> create pluggable database pdb2 from pdb1
FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb1/pdb1/',
'/u01/app/oracle/oradata/cdb1/pdb2/');
OR
----------------------------------------
-- In My Case,I'm using OMF
----------------------------------------
create pluggable database pdb2 from pdb1
FILE_NAME_CONVERT=('/u01/app/oracle/oradata/CDB1/260DCEBE98C33DD5E0530100007F3F93/datafile/o1_mf_system_c62fglyh_.dbf',
'/u01/app/oracle/oradata/CDB1/pdb2/datafile/system01.dbf',
'/u01/app/oracle/oradata/CDB1/260DCEBE98C33DD5E0530100007F3F93/datafile/o1_mf_sysaux_c62fgm20_.dbf',
'/u01/app/oracle/oradata/CDB1/pdb2/datafile/sysaux01.dbf',
'/u01/app/oracle/oradata/CDB1/260DCEBE98C33DD5E0530100007F3F93/datafile/o1_mf_users_c62fm10j_.dbf',
'/u01/app/oracle/oradata/CDB1/pdb2/datafile/users01.dbf',
'/u01/app/oracle/oradata/CDB1/260DCEBE98C33DD5E0530100007F3F93/datafile/o1_mf_slob_c62qjm9g_.dbf',
'/u01/app/oracle/oradata/CDB1/pdb2/datafile/slob01.dbf',
'/u01/app/oracle/oradata/CDB1/260DCEBE98C33DD5E0530100007F3F93/datafile/o1_mf_temp_c62fgm21_.dbf',
'/u01/app/oracle/oradata/CDB1/pdb2/datafile/temp01.dbf');
SQL> alter pluggable database pdb2 open;
SQL> select name ,open_mode from v$pdbs order by name;
SQL> alter pluggable database pdb1 close;
SQL> alter pluggable database pdb1 open;
---------------------------
-- Remove the Clone
----------------------------
SQL> alter pluggable database pdb2 close;
SQL> Drop pluggable database pdb2 including datafiles;
SQL> select name ,open_mode from v$pdbs order by name;
No comments:
Post a Comment