12c: duplicate pluggable database without READ ONLY mode

by Kamil Stawiarski

At the beginning we have to prepare parameter file for the new instance

*.dispatchers='(PROTOCOL=TCP) (SERVICE=skiperXDB)'

Start the instance in nomount

[oracle@rico dbs]$ export ORACLE_SID=skiper
[oracle@rico dbs]$ sqlplus / as sysdba

SQL*Plus: Release Production on Mon May 25 14:32:46 2015

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

Connected to an idle instance.

SQL> create spfile from pfile;

File created.

SQL> startup nomount
ORACLE instance started.

Total System Global Area 1073741824 bytes
Fixed Size		    2932632 bytes
Variable Size		  390070376 bytes
Database Buffers	  675282944 bytes
Redo Buffers		    5455872 bytes

Since I want to duplicate the database in active mode I will register it in LISTENER. To achieve this I have to add the following lines to the listener.ora


Now we can perform active database duplication with only one pluggable database

oracle@rico dbs]$ rman target sys/Oracle123@localhost:1521/rico auxiliary sys/Oracle123@localhost:1521/skiper

Recovery Manager: Release - Production on Mon May 25 14:44:41 2015

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

connected to target database: RICO (DBID=645399623)
connected to auxiliary database: SKIPER (not mounted)

RMAN> duplicate target database to skiper pluggable database ricopdb from active database using compressed backupset;

(output removed for clarity)

Now we have to close the pluggable database and unplug it

SQL> alter pluggable database ricopdb close;

Pluggable database altered.

SQL> alter pluggable database ricopdb unplug into '/home/oracle/ricopdb.xml';

Pluggable database altered.

Now we can plug the database in our original container

SQL> create pluggable database ricotestpdb as clone using '/home/oracle/ricopdb.xml' 
  2  ;

Pluggable database created.

SQL> select con_id, name from v$pdbs;

---------- ------------------------------

If you don’t want to copy datafiles to thair new location, you can use the following statement:

SQL> create pluggable database ricotest2pdb as clone using '/home/oracle/ricopdb.xml'  nocopy;

Pluggable database created.



Database Whisperers sp. z o. o. sp. k.
Al. Jerozolimskie 200
Wejście B, III piętro/ pokój 342
02-486 Warszawa
NIP: 5272744987
+48 508 943 051
+48 661 966 009

Newsletter zapisz się żeby być na bieżąco