At the beginning we have to prepare parameter file for the new instance
*._catalog_foreign_restore=FALSE
*.audit_trail='db'
*.compatible='12.1.0.2.0'
*.db_block_size=8192
*.db_create_file_dest='/u01/app/oracle/oradata'
*.db_domain=''
*.db_name='skiper'
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=4560m
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=skiperXDB)'
*.enable_pluggable_database=true
*.open_cursors=300
*.pga_aggregate_target=512m
*.processes=300
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=1g
*.undo_tablespace=‚UNDOTBS1'
Start the instance in nomount
[oracle@rico dbs]$ export ORACLE_SID=skiper
[oracle@rico dbs]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 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
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=skiper)
(SID_NAME=skiper)
(ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1)
)
)
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 12.1.0.2.0 - 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;
CON_ID NAME
---------- ------------------------------
2 PDB$SEED
3 RICOPDB
4 RICOTESTPDB
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.
FIELD NOTES