Saturday, July 13, 2013

Clone Pluggable Database

If you want to Clone One Of Pluggable database , How can you do that :

SQL> select name from v$pdbs ;

NAME
------------------------------
PDB$SEED
TEST_1
TEST_2
Let's Clone Test_1 , Create folder on os level to move test_1 data. 

[oracle@test12c u01]$ mkdir clone
[oracle@test12c u01]$ cd clone/
[oracle@test12c clone]$ pwd
/u01/clone
Open Test_1 Read Only : 
SQL> alter pluggable database test_1 close immediate;Pluggable database altered.
SQL> alter pluggable database test_1 open read only ;Pluggable database altered.
Set this parameter to our created directory above : 
SQL> show parameter db_create_file_dest ;

NAME     TYPE VALUE
------------------------------------ -----------
db_create_file_dest     string

SQL> alter system set db_create_file_dest='/u01/clone';             System altered.
SQL> show parameter db_create_file_dest ;

NAME     TYPE VALUE
------------------------------------ -----------
db_create_file_dest     string /u01/clone
SQL> create pluggable database clone from test_1 ;Pluggable database created.
SQL> alter pluggable database clone open ;Pluggable database altered.
Test Clone Pluggable database 

[oracle@test12c ~]$ sqlplus sys/sys@test12c:1521/clone as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Sat Jul 13 20:20:24 2013
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

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

SQL> show con_name ;CON_NAME
------------------------------
CLONE
SQL> select name from v$pdbs ;

NAME
------------------------------
PDB$SEED
TEST_1
TEST_2
CLONE
You can drop Clone Database using the below command

SQL > Alter Pluggable database Clone Including Datafiles ;
Thank you 
Osama mustafa

1 comment:

  1. There's something missing in the last part of your post about dropping a PDB:
    SQL> alter pluggable database CLONE close immediate;
    SQL> drop pluggable database CLONE including datafiles;

    ReplyDelete