This method takes advantage of a new feature of RMAN in 12c allowing you to clone database files and apply incrementals to those files from an active database without requiring staging areas. In addition, the source PDB application activity can continue while the cloning and incremental applies are being performed. To get the datafiles in the correct ASM directory for the destination PDB, you perform an RMAN BACKUP AS COPY from the source PDB while also connected to the target CDB. When using OMF or ASM, this will ensure that the datafile copies are written to the correct location. The incremental apply is also performed across the network and applied to the datafiles in their destination location.
This operation requires a temporary instance to be used for the incremental apply. When the datafile copies are created, they aren’t known to any databases on the new environment, by using the temporary instance we create a copy of the source PDB controlfile to the destination environment and catalog the newly created datafile copies in the temporary instance. We now have an instance that is aware of the files and perform recovery on them. The temporary instance is used only for this purpose and can be discarded once the migration process is complete, it should only be started in either nomount or mount mode, it should never be opened.
If you have an Active Data Guard phyiscal standby in place, perform the RMAN BACKUP AS COPY and incremental apply process on both the destination primary and standby environments. This will place the files in the correct location on the destination standby environment so that media recovery of the plugin operation can continue without stopping. You must run the process separately for each destination environment, e.g. you will run an RMAN process to copy the files to your destination primary site and also run an RMAN process to copy the files to your destination standby site, you will create a temporary instance on your destination primary site and your destination standby site, etc. Once the final incremental apply is completed on both the destination primary and standby sites, you can create the new PDB on the primary, no further action need to be taken on the standby site.
The example below documents the process with ASM in use for file storage and with an Active Data Guard physical standby database in place.
1. On the destination primary and standby database environments create a TNS entry to point to the CDB containing the PDB you wish to move. This will be used by RMAN to create the datafile copies on the destination environments and to perform incremental applies across the network with no need for staging area.
CONT4 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = [cont4]) ) )
2. Ensure that there are TNS entries on both the destination primary and standby environments that point to the respective destination instances. In other words, on the destination primary server, there must be a TNS entry pointing to the destination primary database and on the destination standby server, there must be a TNS entry pointing to the destination standby database. These TNS entries can use SCAN hosts.
Destination Primary:
CONT3 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = [cont3]) ) )
Destination Standby:
CONT3STBY = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = [cont3stby]) ) )
3. Copy the TNS entries pointing to the destination primary and standby environments to the source CDB environment. These are required to allow the source database to connect to the destinations as part of the BACKUP AS COPY process. These TNS entries can use SCAN hosts. If you used SCAN hosts for the TNS entry pointing to the CDB source in the destination environment (first step above) and the source CDB is a Real Application Cluster database, these TNS entries pointing to the destination should be on ALL the nodes where the CDB database has instances running.
4. Using RMAN, perform a BACKUP AS COPY of the source PDB to the destination primary and standby environments using the destination primary and standby database instances. This will create datafile copies of the source PDB in the correct directories of ASM on the destination sites, these file copies will not be known to the destination databases at this point. A TNS connection is needed to both the RMAN target (source 12c CDB) and destination (12c CDB). In the RMAN session, connect to the ROOT of the both the source container database and the destination container databases you will be migrating to as the clone.
Create a command file similar to the following. The target is the source non-CDB to be migrated, the clone is the destination CDB in which the new PDB will be created.
Primary:
connect target sys@cont4 connect auxiliary sys@cont3 backup as copy pluggable database [PDB NAME] auxiliary format '+data';
Standby:
connect target sys@cont4 connect auxiliary sys@cont3stby backup as copy pluggable database [PDB NAME] auxiliary format '+datad1';
Ensure backup compression on the disk device type is not enabled on the primary database. Backup as copy is not allowed with compression enabled.
RMAN> show device type;
RMAN configuration parameters for database with db_unique_name NONCDB are:
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
Run the backup as copy command files created in the previous step on both the destination primary site and the destination standby site to copy the files from the source PDB to destination environments. Note the directory structure for the output files on both the primary and the standby environments (lines starting with “output file name”). These directories will be needed in a later step.
Primary:
RMAN> @backup_pdb.cmd RMAN> connect target * target database Password: connected to target database: [CONT4] (DBID=1644992445) RMAN> connect auxiliary * auxiliary database Password: connected to auxiliary database: [CONT3] (DBID=1783201232) RMAN> backup as copy pluggable database [PDB NAME] auxiliary format '+data'; Starting backup at 05-SEP-13 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=204 instance=[cont42] device type=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: SID=239 instance=[cont42] device type=DISK allocated channel: ORA_DISK_3 channel ORA_DISK_3: SID=371 instance=[cont41] device type=DISK allocated channel: ORA_DISK_4 channel ORA_DISK_4: SID=271 instance=[cont42] device type=DISK allocated channel: ORA_DISK_5 channel ORA_DISK_5: SID=402 instance=[cont41] device type=DISK allocated channel: ORA_DISK_6 channel ORA_DISK_6: SID=306 instance=[cont42] device type=DISK allocated channel: ORA_DISK_7 channel ORA_DISK_7: SID=438 instance=[cont41] device type=DISK allocated channel: ORA_DISK_8 channel ORA_DISK_8: SID=343 instance=[cont42] device type=DISK channel ORA_DISK_1: starting datafile copy input datafile file number=00045 name=+DATAD1/[CONT4]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/soets2.531.825347311 channel ORA_DISK_2: starting datafile copy input datafile file number=00043 name=+DATAD1/[CONT4]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/sysaux.284.825346821 channel ORA_DISK_3: starting datafile copy input datafile file number=00042 name=+DATAD1/[CONT4]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/system.530.825346821 output file name=+DATA/[CONT3]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/system.394.825355197 tag=TAG20130905T151946 # Save this directory name to be used later channel ORA_DISK_3: datafile copy complete, elapsed time: 00:00:49 output file name=+DATA/[CONT3]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/sysaux.395.825355195 tag=TAG20130905T151946 channel ORA_DISK_2: datafile copy complete, elapsed time: 00:01:23 output file name=+DATA/[CONT3]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/soets2.396.825355193 tag=TAG20130905T151946 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:06:32 Finished backup at 05-SEP-13 RMAN> **end-of-file**
Standby:
RMAN> @backup_pdb.cmd RMAN> connect target * target database Password: connected to target database: [CONT4] (DBID=1644992445) RMAN> connect auxiliary * auxiliary database Password: connected to auxiliary database: [CONT3] (DBID=1783201232) RMAN> backup as copy pluggable database [PDB NAME] auxiliary format '+datad1'; Starting backup at 05-SEP-13 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=105 instance=[cont42] device type=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: SID=207 instance=[cont41] device type=DISK allocated channel: ORA_DISK_3 channel ORA_DISK_3: SID=141 instance=[cont42] device type=DISK allocated channel: ORA_DISK_4 channel ORA_DISK_4: SID=244 instance=[cont41] device type=DISK allocated channel: ORA_DISK_5 channel ORA_DISK_5: SID=275 instance=[cont41] device type=DISK allocated channel: ORA_DISK_6 channel ORA_DISK_6: SID=307 instance=[cont41] device type=DISK allocated channel: ORA_DISK_7 channel ORA_DISK_7: SID=173 instance=[cont42] device type=DISK allocated channel: ORA_DISK_8 channel ORA_DISK_8: SID=346 instance=[cont41] device type=DISK channel ORA_DISK_1: starting datafile copy input datafile file number=00045 name=+DATAD1/[CONT4]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/soets2.531.825347311 channel ORA_DISK_2: starting datafile copy input datafile file number=00043 name=+DATAD1/[CONT4]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/sysaux.284.825346821 channel ORA_DISK_3: starting datafile copy input datafile file number=00042 name=+DATAD1/[CONT4]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/system.530.825346821 output file name=+DATAD1/CONT3STBY/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/sysaux.518.825347897 tag=TAG20130905T151815 # Save this directory name to be used later channel ORA_DISK_2: datafile copy complete, elapsed time: 00:00:07 output file name=+DATAD1/[CONT3STBY]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/system.499.825347897 tag=TAG20130905T151815 channel ORA_DISK_3: datafile copy complete, elapsed time: 00:00:07 output file name=+DATAD1/[CONT3STBY]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/soets2.498.825347897 tag=TAG20130905T151815 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35 Finished backup at 05-SEP-13 RMAN> RMAN> **end-of-file**
5. Copy the password file from the source CDB to the destination sites (both primary and standby) for the temp instances. The following example shows the password file stored in ASM for the source CDB. The password file is extracted from ASM on the source and written to a local filesystem, then remote copied to the destination environment (both primary and standby). For ease of use, the files should be copied to the $ORACLE_HOME/dbs directory (default location) being used by the temporary instance on the destination environments and should be given a default name of orapw[$ORACLE_SID of the temporary instance].
[oracle@source]$ asmcmd -p ASMCMD [+] > cd datad1/cont4 ASMCMD [+datad1/cont4] > cp orapwcont4 /home/oracle/[temp]/orapwtemp copying +datad1/cont4/orapwcont4 -> /home/oracle/[temp]/orapwtemp
[oracle@source]$ scp /home/oracle/[temp]/orapwtemp oracle@destination-prim:[ORACLE_HOME]/dbs [oracle@source]$ scp /home/oracle/[temp]/orapwtemp oracle@destination-stby:[ORACLE_HOME]/dbs
6. Create a small pfile for the temporary instances. Although not required to be different for the destination primary and standby environments, for clarity they are different in this example with each temporary instance getting a different DB_UNIQUE_NAME. Note the comments for each initialization parameter setting.
Primary:
db_name=[cont4] # MUST match db_name of source CDB db_unique_name=junk # ONLY required if the source db is on the same system as the TEMP instance control_files='/home/oracle/demo/control1.ctl','/home/oracle/demo/control2.ctl' # Just use local files compatible='12.1.0.0.0' # Required if compatible is not set to default value enable_pluggable_database=TRUE # Since the source is a CDB, we must specify the enable_pluggable_database parameter
Standby:
db_name=[cont4] # MUST match db_name of source CDB db_unique_name=junk # ONLY required if the source db is on the same system as the TEMP instance control_files='/home/oracle/demo/control1.ctl','/home/oracle/demo/control2.ctl' # Just use local files compatible='12.1.0.0.0' # required if compatible is not set to default value enable_pluggable_database=TRUE # Since the source is a CDB, we must specify the enable_pluggable_database parameter
7. Create a TNS alias for the destination temporary instances. This should be done on the environment you will be running RMAN (in this example, the destination primary and standby environments). If you needed to specify DB_UNIQUE_NAME, the same value must also be specified for the SERVICE_NAME in the TNS address. Do not use the SCAN address for the host as the temporary instances will not be registered with the SCAN listener. (UR = A) is required to allow you to connect to the service while the database is in mount/nomount mode.
Primary:
TEMP = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = [primdb01])(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = junk) (UR = A) ) )
Standby:
TEMPSTBY = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = [stbyadm04])(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = junkstby) (UR = A) ) )
8. Startup nomount the temporary instances on the destination primary and standby environments.
Primary:
$ export ORACLE_SID=[temp] $ sqlplus / as sysdba SQL*Plus: Release 12.1.0.1.0 Production on Wed Sep 4 12:51:52 2013 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to an idle instance. SQL> startup nomount pfile='/home/oracle/demo/pfile.ora' ORACLE instance started. Total System Global Area 384200704 bytes Fixed Size 2288536 bytes Variable Size 322962536 bytes Database Buffers 50331648 bytes Redo Buffers 8617984 bytes
Standby:
$ export ORACLE_SID=[tempstby] $ sqlplus / as sysdba SQL*Plus: Release 12.1.0.1.0 Production on Wed Sep 4 10:53:06 2013 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to an idle instance. SQL> startup nomount pfile='/home/oracle/demo/pfile.ora' ORACLE instance started. Total System Global Area 634732544 bytes Fixed Size 2291424 bytes Variable Size 524290336 bytes Database Buffers 100663296 bytes Redo Buffers 7487488 bytes
9. Restore the controlfile from the source CDB to both the destination primary and standby environment temporary instances. Connect to the temporary instance using TNS (e.g. rman target sys@temp).
The FROM SERVICE clause in the RESTORE command provides the connection to the source CDB. The clause in the example uses the TNS alias for the source CDB created above. This is the only connection used and required for the source CDB in these commands.
Primary:
$ rman Recovery Manager: Release 12.1.0.1.0 - Production on Thu Sep 5 15:02:34 2013 Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved. RMAN> connect target sys@target database Password: connected to target database: [CONT4] (not mounted)
RMAN> restore controlfile from service [cont4]; Starting restore at 05-SEP-13 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=790 device type=DISK channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: using network backup set from service cont4 channel ORA_DISK_1: restoring control file channel ORA_DISK_1: restore complete, elapsed time: 00:00:07 output file name=/home/oracle/demo/control1.ctl output file name=/home/oracle/demo/control2.ctl Finished restore at 05-SEP-13
Standby:
$ rman Recovery Manager: Release 12.1.0.1.0 - Production on Thu Sep 5 13:03:04 2013 Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved. RMAN> connect target sys@[tempstby] target database Password: connected to target database: [CONT4] (not mounted)
RMAN> restore controlfile from service [cont4]; Starting restore at 05-SEP-13 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=514 device type=DISK channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: using network backup set from service [CONT4] channel ORA_DISK_1: restoring control file channel ORA_DISK_1: restore complete, elapsed time: 00:00:03 output file name=/home/oracle/demo/control1.ctl output file name=/home/oracle/demo/control2.ctl Finished restore at 05-SEP-13
10. Mount the temporary instances on the destination primary and standby environments to allow for cataloging the cloned database files.
RMAN> alter database mount; Statement processed released channel: ORA_DISK_1
11. Catalog the datafiles in the temporary instances on the destination primary and standby environments using “START WITH” to locate the datafile copies restored above. The directory location can be found in the BACKUP AS COPY screen output starting with “output file name”.
Primary:
RMAN> catalog start with '+DATA/[CONT3]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE'; searching for all files that match the pattern +DATA/[CONT3]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE List of Files Unknown to the Database ===================================== File Name: +DATA/[CONT3]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/SOETS2.396.825355193 File Name: +DATA/[CONT3]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/SYSAUX.395.825355195 File Name: +DATA/[CONT3]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/SYSTEM.394.825355197 Do you really want to catalog the above files (enter YES or NO)? yes cataloging files... cataloging done List of Cataloged Files ======================= File Name: +DATA/[CONT3]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/SOETS2.396.825355193 File Name: +DATA/[CONT3]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/SYSAUX.395.825355195 File Name: +DATA/[CONT3]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/SYSTEM.394.825355197
Standby:
RMAN> catalog start with '+DATAD1/[CONT3STBY]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE'; searching for all files that match the pattern +DATAD1/[CONT3STBY]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE List of Files Unknown to the Database ===================================== File Name: +DATAD1/[CONT3STBY]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/SYSAUX.518.825347897 File Name: +DATAD1/[CONT3STBY]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/SOETS2.498.825347897 File Name: +DATAD1/[CONT3STBY]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/SYSTEM.499.825347897 Do you really want to catalog the above files (enter YES or NO)? yes cataloging files... cataloging done List of Cataloged Files ======================= File Name: +DATAD1/[CONT3STBY]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/SYSAUX.518.825347897 File Name: +DATAD1/[CONT3STBY]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/SOETS2.498.825347897 File Name: +DATAD1/[CONT3STBY]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/SYSTEM.499.825347897
12. Switch the pluggable database to copy in the temporary instances on the destination primary and standby environments to the datafiles just cataloged.
Primary:
RMAN> switch pluggable database [PDB NAME] to copy; datafile 42 switched to datafile copy "+DATA/[CONT3]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/system.394.825355197" datafile 43 switched to datafile copy "+DATA/[CONT3]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/sysaux.395.825355195" datafile 45 switched to datafile copy "+DATA/[CONT3]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/soets2.396.825355193"
Standby:
RMAN> switch pluggable database [PDB NAME] to copy; datafile 42 switched to datafile copy "+DATAD1/[CONT3STBY]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/system.499.825347897" datafile 43 switched to datafile copy "+DATAD1/[CONT3STBY]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/sysaux.518.825347897" datafile 45 switched to datafile copy "+DATAD1/[CONT3STBY]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/soets2.498.825347897"
13. Set parallelism on both destination primary and standby temporary instances:
RMAN> configure device type disk parallelism 8; old RMAN configuration parameters: CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; new RMAN configuration parameters: CONFIGURE DEVICE TYPE DISK PARALLELISM 8 BACKUP TYPE TO BACKUPSET; new RMAN configuration parameters are successfully stored
14. At periodic intervals, perform incremental applies from the source PDB to the temporary instances on the destination primary and standby environments to keep the destination datafiles somewhat current. This can be done as many times as necessary until you are ready to perform the migration. The incremental process will compare the files in the temporary instances with the files in the source PDB and determine which files need recovery applied, thus the recovery work that is done can be different in each of the primary environment temporary instance and the standby temporary instance, depending on the states of their respective files. The source PDB can continue application activity while the incremental applies are occurring.
The FROM SERVICE clause in the RECOVER command provides the connection to the source CDB (we do not need to connect to the source PDB). The clause in the example uses the TNS alias for the source CDB created above. This is the only connection used and required for the source PDB in these commands.
Primary:
RMAN> connect target sys@[temp] target database Password: connected to target database: [CONT4] (mounted)
RMAN> recover pluggable database [PDB NAME] noredo from service [cont4]; Starting recover at 05-SEP-13 using channel ORA_DISK_1 using channel ORA_DISK_2 using channel ORA_DISK_3 using channel ORA_DISK_4 using channel ORA_DISK_5 using channel ORA_DISK_6 using channel ORA_DISK_7 using channel ORA_DISK_8 channel ORA_DISK_1: starting incremental datafile backup set restore channel ORA_DISK_1: using network backup set from service cont4 destination for restore of datafile 00042: +DATA/[CONT3]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/system.394.825355197 channel ORA_DISK_2: starting incremental datafile backup set restore channel ORA_DISK_2: using network backup set from service cont4 destination for restore of datafile 00043: +DATA/[CONT3]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/sysaux.395.825355195 channel ORA_DISK_3: starting incremental datafile backup set restore channel ORA_DISK_3: using network backup set from service cont4 destination for restore of datafile 00045: +DATA/[CONT3]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/soets2.396.825355193 channel ORA_DISK_1: restore complete, elapsed time: 00:00:08 channel ORA_DISK_2: restore complete, elapsed time: 00:00:08 channel ORA_DISK_3: restore complete, elapsed time: 00:00:45 Finished recover at 05-SEP-13
Standby:
RMAN> connect target sys@[tempstby] target database Password: connected to target database: [CONT4] (mounted)
RMAN> recover pluggable database [PDB NAME] noredo from service [cont4]; Starting recover at 05-SEP-13 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=770 device type=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: SID=834 device type=DISK allocated channel: ORA_DISK_3 channel ORA_DISK_3: SID=898 device type=DISK allocated channel: ORA_DISK_4 channel ORA_DISK_4: SID=961 device type=DISK allocated channel: ORA_DISK_5 channel ORA_DISK_5: SID=1026 device type=DISK allocated channel: ORA_DISK_6 channel ORA_DISK_6: SID=1090 device type=DISK allocated channel: ORA_DISK_7 channel ORA_DISK_7: SID=1154 device type=DISK allocated channel: ORA_DISK_8 channel ORA_DISK_8: SID=1218 device type=DISK channel ORA_DISK_1: starting incremental datafile backup set restore channel ORA_DISK_1: using network backup set from service cont4 destination for restore of datafile 00042: +DATAD1/[CONT3STBY]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/system.499.825347897 channel ORA_DISK_2: starting incremental datafile backup set restore channel ORA_DISK_2: using network backup set from service cont4 destination for restore of datafile 00043: +DATAD1/[CONT3STBY]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/sysaux.518.825347897 channel ORA_DISK_3: starting incremental datafile backup set restore channel ORA_DISK_3: using network backup set from service cont4 destination for restore of datafile 00045: +DATAD1/[CONT3STBY]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/soets2.498.825347897 channel ORA_DISK_1: restore complete, elapsed time: 00:00:03 channel ORA_DISK_2: restore complete, elapsed time: 00:00:03 channel ORA_DISK_3: restore complete, elapsed time: 00:00:15 Finished recover at 05-SEP-13
15. Build the plugin statement to be executed on the destination primary database. Use the SOURCE_FILE_DIRECTORY clause to point to the location where the files were restored to on the destination CDB primary database environment. Note that the plugin process will search for files in the SOURCE_FILE_DIRECTORY that match the information contained in the XML file created by the unplug operation. Use the NOCOPY clause as the files are already in their intended location. The statement can be pre-created outside of the outage window.
create pluggable database [PDB NAME] using '/home/oracle/demo/[PDB NAME]_unplug.xml' source_file_directory= '+DATA/[CONT3]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE' nocopy;
16. Shutdown the source PDB:
SQL> alter pluggable database [PDB NAME] close instances=all; Pluggable database altered.
17. Unplug the source PDB and create the manifest XML file:
SQL> alter pluggable database [PDB NAME] unplug into '/home/oracle/cont4/[PDB NAME]_unplug.xml'; Pluggable database altered.
18. Perform a final incremental apply through the temporary instances on the destination primary and standby environments. The source CDB must be open during this process (the source PDB remains closed).
Primary:
RMAN> connect target sys@[temp] target database Password: connected to target database: [CONT4] (DBID=1644992445, not open)
RMAN> recover pluggable database [PDB NAME] noredo from service [cont4]; Starting recover at 05-SEP-13 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=267 device type=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: SID=398 device type=DISK allocated channel: ORA_DISK_3 channel ORA_DISK_3: SID=529 device type=DISK allocated channel: ORA_DISK_4 channel ORA_DISK_4: SID=660 device type=DISK allocated channel: ORA_DISK_5 channel ORA_DISK_5: SID=791 device type=DISK allocated channel: ORA_DISK_6 channel ORA_DISK_6: SID=922 device type=DISK allocated channel: ORA_DISK_7 channel ORA_DISK_7: SID=6 device type=DISK allocated channel: ORA_DISK_8 channel ORA_DISK_8: SID=137 device type=DISK channel ORA_DISK_1: starting incremental datafile backup set restore channel ORA_DISK_1: using network backup set from service cont4 destination for restore of datafile 00042: +DATA/[CONT3]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/system.394.825355197 channel ORA_DISK_2: starting incremental datafile backup set restore channel ORA_DISK_2: using network backup set from service cont4 destination for restore of datafile 00043: +DATA/[CONT3]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/sysaux.395.825355195 channel ORA_DISK_3: starting incremental datafile backup set restore channel ORA_DISK_3: using network backup set from service cont4 destination for restore of datafile 00045: +DATA/[CONT3]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/soets2.396.825355193 channel ORA_DISK_1: restore complete, elapsed time: 00:00:08 channel ORA_DISK_2: restore complete, elapsed time: 00:00:08 channel ORA_DISK_3: restore complete, elapsed time: 00:00:45 Finished recover at 05-SEP-13
Standby:
RMAN> connect target sys@[tempstby] target database Password: connected to target database: [CONT4] (DBID=1644992445, not open)
RMAN> recover pluggable database [PDB NAME] noredo from service [cont4]; Starting recover at 05-SEP-13 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=770 device type=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: SID=834 device type=DISK allocated channel: ORA_DISK_3 channel ORA_DISK_3: SID=898 device type=DISK allocated channel: ORA_DISK_4 channel ORA_DISK_4: SID=961 device type=DISK allocated channel: ORA_DISK_5 channel ORA_DISK_5: SID=1026 device type=DISK allocated channel: ORA_DISK_6 channel ORA_DISK_6: SID=1090 device type=DISK allocated channel: ORA_DISK_7 channel ORA_DISK_7: SID=1154 device type=DISK allocated channel: ORA_DISK_8 channel ORA_DISK_8: SID=1218 device type=DISK channel ORA_DISK_1: starting incremental datafile backup set restore channel ORA_DISK_1: using network backup set from service cont4 destination for restore of datafile 00042: +DATAD1/[CONT3STBY]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/system.499.825347897 channel ORA_DISK_2: starting incremental datafile backup set restore channel ORA_DISK_2: using network backup set from service cont4 destination for restore of datafile 00043: +DATAD1/[CONT3STBY]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/sysaux.518.825347897 channel ORA_DISK_3: starting incremental datafile backup set restore channel ORA_DISK_3: using network backup set from service cont4 destination for restore of datafile 00045: +DATAD1/[CONT3STBY]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/soets2.498.825347897 channel ORA_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_DISK_2: restore complete, elapsed time: 00:00:01 channel ORA_DISK_3: restore complete, elapsed time: 00:00:07 Finished recover at 05-SEP-13
19. Shutdown the temporary instances.
20. Copy the manifest file to the destination primary host.
21. If your diskgroup names are different between your destination primary and standby, ensure that you have db_file_name_convert set on the standby specifying only the diskgroup names.
SQL> show parameter db_file_name_convert NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_file_name_convert string +DATA, +DATAC1
22. Plug the PDB into the new CDB using the manifest file created above. As long as the files already exist on the standby prior to the plugin, are in the correct directory ([dgname]/[dbuniqname]/[guid]/DATAFILE) and are current on the destination standby environment, no additional steps are needed for the standby. Media recovery will find the files and continue processing.
SQL> set echo on SQL> @plugin_[PDB NAME] SQL> create pluggable database [PDB NAME] using '/home/oracle/demo/[PDB NAME]_unplug.xml' 2 source_file_directory= '+DATA/[CONT3]/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE' 3 nocopy; Pluggable database created.
23. Since the source was already a PDB, all we need to do is sync the new PDB:
SQL> alter pluggable database [PDB NAME] open restricted; Pluggable database altered. SQL> alter session set container=[PDB NAME]; Session altered. SQL> exec dbms_pdb.sync_pdb(); PL/SQL procedure successfully completed.
24. Open the PDB on the destination primary. The PDB will have a STATUS of NEW until the PDB is opened for the first time at the primary database at which time the status will change to NORMAL. This initial open must be performed on the primary. There is a small amount of redo generated by this initial open which will be transported to the standby database and applied via media recovery. Until this redo is applied on the standby to change the status from NEW to NORMAL, the PDB cannot be opened on the standby database.
SQL> alter session set container=cdb$root; Session altered. SQL> alter pluggable database [PDB NAME] close; Pluggable database altered. SQL> alter pluggable database [PDB NAME] open instances=all; Pluggable database altered.
25. Open the PDB on destination standby. Ensure the status is NORMAL first. If you did not specify the TEMPFILE REUSE clause on the CREATE PLUGGABLE DATABASE statement, add a file to the TEMP tablespace on the standby.
SQL> col pdb_name format a30 SQL> select pdb_name, status from cdb_pdbs; PDB_NAME STATUS ------------------------------ ------------- PDB$SEED NORMAL STARK NORMAL BARNEY NORMAL MY_PDB NORMAL
SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 STARK MOUNTED 4 MY_PDB READ ONLY NO 5 BARNEY MOUNTED
SQL> alter pluggable database [PDB NAME] open instances=all; Pluggable database altered. SQL> alter session set container=[PDB NAME]; Session altered. SQL> alter tablespace temp add tempfile '+DATAd1' size 10g; Tablespace altered.
26. Backup the PDB. It cannot be recovered on the new container database without a backup:
RMAN> backup pluggable database [PDB NAME]; Starting backup at 06-SEP-13 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=122 instance=cont31 device type=DISK channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00047 name=+DATA/CONT3/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/soets2.396.825355193 input datafile file number=00046 name=+DATA/CONT3/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/sysaux.395.825355195 input datafile file number=00045 name=+DATA/CONT3/E5AA35C304D68CBBE043F646F40AEE75/DATAFILE/system.394.825355197 channel ORA_DISK_1: starting piece 1 at 06-SEP-13 channel ORA_DISK_1: finished piece 1 at 06-SEP-13 piece handle=+RECO/CONT3/E5AA35C304D68CBBE043F646F40AEE75/BACKUPSET/2013_09_06/nnndf0_tag20130906t152412_0.525.825434653 tag=TAG20130906T152412 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15 Finished backup at 06-SEP-13 Starting Control File and SPFILE Autobackup at 06-SEP-13 piece handle=+RECO/CONT3/AUTOBACKUP/2013_09_06/s_825434668.769.825434669 comment=NONE Finished Control File and SPFILE Autobackup at 06-SEP-13