Thursday, July 25, 2013

Clone PDB (12c Pluggable Database)

Clone PDB
Note: The Clone is done on the same server.

1)  Shutdown  the pdb1
SQL> alter pluggable database pdb1 close;

Pluggable database altered.

2)  Open pdb1  in read only mode
SQL> alter pluggable database pdb1 open read only;

Pluggable database altered.

3) Clone using the below command
SQL> create pluggable database pdb2 from pdb1
FILE_NAME_CONVERT=('/12c/db/pdb1','/12c/db/pdb2');

Pluggable database created.

Elapsed: 00:01:00.23

4) Open the pdb2
SQL> alter pluggable database pdb2 open;

Pluggable database altered.

Elapsed: 00:00:08.95

5) Check the listener to make sure the pdb2 is listed and add the entry in oratab and tnsnames.ora (to use it in oraenv for setting the environment).

6) Connect to the pdb2 and play  ...
--> sqlplus srini/srini@pdb2

SQL*Plus: Release 12.1.0.1.0 Production on Thu Jul 25 07:23:10 2013

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Last Successful login time: Thu Jul 15 2013 09:12:20 -05:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> show con_name

CON_NAME
------------------------------
PDB2


SQL> conn sys@pdb2 as sysdba
Enter password:
Connected.
SQL> select sum(bytes/1024/1024/1024) from dba_data_files;

SUM(BYTES/1024/1024/1024)
-------------------------
               9.21

7) The 9GB DB was cloned in a Minute .


No comments:

Post a Comment