Cloning of PDB database into same CDB database Oracle

Cloning of PDB database into same CDB database in Oracle 12c

Step 1: Create new directory in oradata folder e.g PDB2 (location where you want to create database).
 
Step 2: Connect to container database( CDB)
sqlplus sys as sysdba
 
Step 3: Check the pluggable database status

SQL> select name,open_mode from v$pdbs;
NAME OPEN_MODE
-------- -----------
PDB$SEED READ ONLY
PDB1 READ WRITE

Step 4: Close the pdb1 database

SQL> alter pluggable database pdb1 close;
Pluggable database altered.

step 5: Open in read only mode PDB1 database.

SQL> alter pluggable database pdb1 open read only;
Pluggable database altered.

Step 6: Start cloning process from pdb1 to pdb2.

SQL> create pluggable database pdb2 from pdb1 create_file_dest='D:\container\oradata\cdb1\pdb2';

OR

SQL> CREATE PLUGGABLE DATABASE pdb3 FROM pdb1
FILE_NAME_CONVERT = ('D:\container\oradata\cdb1\pdb1', 'D:\container\oradata\cdb1\pdb3')
PATH_PREFIX = 'D:\container\oradata\cdb1\pdb3';
Pluggable database created.

Note: With first command: It will create files as oracle managed file system otherwise you need to specify manually each file.
 
Step 7: Check the database

SQL> select name,open_mode from v$pdbs;

NAME      OPEN_MODE
--------  -----------
PDB$SEED  READ ONLY
PDB1      READ ONLY
PDB2      MOUNTED


Step 8: Open the database for user

alter pluggable database pdb1 close;
alter pluggable database pdb1 open;

alter pluggable database pdb2 close;
alter pluggable database pdb2 open;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s