iSelfSchooling.com  Since 1999     References  |  Search more  | Oracle Syntax  | Free Online Oracle Training

    Home      .Services     Login       Start Learning     Certification      .                 .Share your BELIEF(s)...

 

. Online Accounting        .Copyright & User Agreement   |
    .Vision      .Biography     .Acknowledgement

.Contact Us      .Comments/Suggestions       Email2aFriend    |

 

Oracle 12c New Features

Online Oracle Training

LESSON 27

 

How to clone a pluggable database (PDB) from one container database to another or itself

Assumptions:
Container databases:
MYCDBX " From container we clone a pluggable database
MYCDBY " To container we clone a pluggable database

Pluggable database:
MYPDB1 " the pluggable database from the MYCDBX container
MYPDB1_CLONE " a pluggable database we clone to MYCDBY container

MYCDBX container
MYPDB1 pluggable database --> cloning and name it MYYPDB1_CLONE in MYCDBY container

Steps:
Step #1:
Change the MYPDB1 pluggable database to READ ONLY mode.
First you need to close the pluggable database then you open it with the READ ONLY mode.
SQL> connect / as sysdba
SQL> ALTER PLUGGABLE DATABASE mypdb1 CLOSE IMMEDIATE;
SQL> ALTER PLUGGABLE DATABASE mypdb1 OPEN READ ONLY;

Step #2:
Go to other server and define space for your new cloned pluggable database. Then set default destination to the created directory.
# cd /oradata
# cd MYPDBY
# pwd
/oradata/MYPDBY
# mkdir mypdb1_clone

Login to SQLPLUS to set your destination.
SQL> ALTER SYSTEM SET db_create_file_dest="/oradata/MYPDBY/mypdb1_clone";

Step #3:
Create your clone.
SQL> CREATE PLUGGABLE DATABASE mypdb1_clone FROM mypdb1@mycdbx;

Open it.
SQL> ALTER PLUGGABLE DATABASE mypdb1_clone OPEN;

Connect to it by using service name or use direct string connection.
SQL> connect system/mypass@myserver:1521/mycdb1_clone;

Check it.
SQL> show con_name
SQL> select name from v$services;

 

=================


Change the source pluggable database from READ ONLY to READ WRITE mode.
SQL> connect / as sysdba
or
SQL> ALTER SESSION SET container=cdb$root;
SQL> ALTER PLUGGABLE DATABASE mypdb1 CLOSE IMMEDIATE;
SQL> ALTER PLUGGBALE DATABASE mypdb1 OPEN;

To drop your clone:
SQL> connect / as sysdba
SQL> ALTER PLUGGABLE DATABASE mypdb1_clone CLOSE IMMEDIATE;
SQL> DROP PLUGGABLE DATABASE mypdb1_clone INCLUDING DATAFILES;

Good Luck!

 

Google
 
Web web site