Image-Based duplication is rather tricky and complicated than Active Database duplication. The following is the summary of key steps:
- Make a copy of controlfile for standby.
- Save a copy of the standby controlfile to the standby.
- Save a copy of the datafiles to the standby.
- Restore the standby controlfile in the standby database.
- Mount the standby database.
- Catalog the location of the image copies.
- Switch the datafiles to the image copies.
- Recover managed standby database.
Here are the steps:
- Startup one node of the standby cluster database to nomount state.
- Connect to the target and auxiliary database with RMAN.
- Make a copy of the standby controlfile.
- Save a copy of the standby controlfile to the auxiliary database.
- Save a copy of the datafiles to the auxiliary database.
- Connect to the standby database with RMAN.
- Restore controlfile from the standby controlfile.
- Mount and check the standby database.
- Catalog and list the image copies of datafiles.
- Switch all the datafiles to the new image copies.
- Restart all nodes of the standby cluster database to mount and check the status.
- Start the apply service to recover managed standby database.
[oracle@standby01 ~]$ srvctl stop database -d compdb
[oracle@standby01 ~]$ sqlplus / as sysdba
...
Connected to an idle instance.
SQL> startup nomount;
...
[oracle@primary01 ~]$ rman target sys/password@primdb1 auxiliary sys/password@standb1
...
connected to target database: COMPDB (DBID=841830157)
connected to auxiliary database: COMPDB (not mounted)
RMAN> backup as copy current controlfile for standby;
Starting backup at 23-JAN-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=102 instance=primdb1 device type=DISK
channel ORA_DISK_1: starting datafile copy
copying standby control file
output file name=+DATA/primdb/controlfile/backup.1121.805481453 tag=TAG20130123T165051 RECID=18 STAMP=805481459
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
Finished backup at 23-JAN-13
Starting Control File and SPFILE Autobackup at 23-JAN-13
piece handle=+DATA/primdb/autobackup/2013_01_23/s_805481467.1122.805481471 comment=NONE
Finished Control File and SPFILE Autobackup at 23-JAN-13
RMAN> backup as copy controlfilecopy '+DATA/primdb/controlfile/backup.1121.805481453' auxiliary format '+data';
Starting backup at 23-JAN-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input control file copy name=+DATA/primdb/controlfile/backup.1121.805481453
output file name=+DATA/standb/controlfile/backup.268.805481577 tag=TAG20130123T165051
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
Finished backup at 23-JAN-13
RMAN> backup as copy database auxiliary format '+data';
Starting backup at 23-JAN-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=+DATA/primdb/datafile/system.897.797943475
output file name=+DATA/standb/datafile/system.1108.805481609 tag=TAG20130123T165327
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=+DATA/primdb/datafile/sysaux.898.797943569
output file name=+DATA/standb/datafile/sysaux.1109.805481683 tag=TAG20130123T165327
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:35
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=+DATA/primdb/datafile/undotbs1.899.797943687
output file name=+DATA/standb/datafile/undotbs1.1110.805481779 tag=TAG20130123T165327
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=+DATA/primdb/datafile/example.900.797943711
output file name=+DATA/standb/datafile/example.1111.805481793 tag=TAG20130123T165327
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=+DATA/primdb/datafile/undotbs2.901.797943737
output file name=+DATA/standb/datafile/undotbs2.1112.805481809 tag=TAG20130123T165327
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=+DATA/primdb/datafile/users.902.797943753
output file name=+DATA/standb/datafile/users.271.805481825 tag=TAG20130123T165327
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 23-JAN-13
RMAN>
[oracle@standby01 ~]$ rman target /
...
connected to target database: COMPDB (not mounted)
RMAN> restore controlfile from '+DATA/standb/controlfile/backup.268.805481577';
Starting restore at 23-JAN-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=33 instance=standb1 device type=DISK
channel ORA_DISK_1: copied control file copy
output file name=+DATA/standb/controlfile/current.269.805480253
Finished restore at 23-JAN-13
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
...
SQL> select inst_id, open_mode, database_role, switchover_status from gv$database;
INST_ID OPEN_MODE DATABASE_ROLE SWITCHOVER_STATUS
---------- -------------------- ---------------- --------------------
1 MOUNTED PHYSICAL STANDBY SESSIONS ACTIVE
DATABASE_ROLE is PHYSICAL STANDBY now.
RMAN> catalog start with '+data/standb' noprompt;
Starting implicit crosscheck backup at 23-JAN-13
allocated channel: ORA_DISK_1
Crosschecked 8 objects
Finished implicit crosscheck backup at 23-JAN-13
Starting implicit crosscheck copy at 23-JAN-13
using channel ORA_DISK_1
Crosschecked 8 objects
Finished implicit crosscheck copy at 23-JAN-13
searching for all files in the recovery area
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: +data/STANDB/CONTROLFILE/backup.268.805481577
File Name: +data/STANDB/AUTOBACKUP/2013_01_19/s_805122438.1094.805123331
File Name: +data/STANDB/DATAFILE/SYSTEM.1108.805481609
File Name: +data/STANDB/DATAFILE/SYSAUX.1109.805481683
File Name: +data/STANDB/DATAFILE/UNDOTBS1.1110.805481779
File Name: +data/STANDB/DATAFILE/EXAMPLE.1111.805481793
File Name: +data/STANDB/DATAFILE/UNDOTBS2.1112.805481809
File Name: +data/STANDB/DATAFILE/USERS.271.805481825
...
RMAN> list copy of database;
List of Datafile Copies
=======================
Key File S Completion Time Ckp SCN Ckp Time
------- ---- - --------------- ---------- ---------------
21 1 A 23-JAN-13 3109920 23-JAN-13
Name: +DATA/standb/datafile/system.1108.805481609
Tag: TAG20130123T165327
22 2 A 23-JAN-13 3110024 23-JAN-13
Name: +DATA/standb/datafile/sysaux.1109.805481683
Tag: TAG20130123T165327
23 3 A 23-JAN-13 3110296 23-JAN-13
Name: +DATA/standb/datafile/undotbs1.1110.805481779
Tag: TAG20130123T165327
26 4 A 23-JAN-13 3110454 23-JAN-13
Name: +DATA/standb/datafile/users.271.805481825
Tag: TAG20130123T165327
24 5 A 23-JAN-13 3110321 23-JAN-13
Name: +DATA/standb/datafile/example.1111.805481793
Tag: TAG20130123T165327
25 6 A 23-JAN-13 3110425 23-JAN-13
Name: +DATA/standb/datafile/undotbs2.1112.805481809
Tag: TAG20130123T165327
RMAN> switch database to copy;
datafile 1 switched to datafile copy "+DATA/standb/datafile/system.1108.805481609"
datafile 2 switched to datafile copy "+DATA/standb/datafile/sysaux.1109.805481683"
datafile 3 switched to datafile copy "+DATA/standb/datafile/undotbs1.1110.805481779"
datafile 4 switched to datafile copy "+DATA/standb/datafile/users.271.805481825"
datafile 5 switched to datafile copy "+DATA/standb/datafile/example.1111.805481793"
datafile 6 switched to datafile copy "+DATA/standb/datafile/undotbs2.1112.805481809"
RMAN> shutdown immediate;
database dismounted
Oracle instance shut down
...
[oracle@standby01 ~]$ srvctl start database -d compdb -o mount
[oracle@standby01 ~]$ sqlplus / as sysdba
...
SQL> select inst_id, open_mode, database_role, switchover_status from gv$database;
INST_ID OPEN_MODE DATABASE_ROLE SWITCHOVER_STATUS
---------- -------------------- ---------------- --------------------
1 MOUNTED PHYSICAL STANDBY RECOVERY NEEDED
2 MOUNTED PHYSICAL STANDBY RECOVERY NEEDED
SQL> select inst_id, process, status, thread#, sequence#, block#, blocks from gv$managed_standby where process in ('RFS','LNS') or process like 'MR%';
INST_ID PROCESS STATUS THREAD# SEQUENCE# BLOCK# BLOCKS
---------- --------- ------------ ---------- ---------- ---------- ----------
2 RFS IDLE 0 0 0 0
2 RFS IDLE 0 0 0 0
2 RFS IDLE 1 96 164 1
2 RFS IDLE 0 0 0 0
2 RFS IDLE 0 0 0 0
2 RFS IDLE 0 0 0 0
6 rows selected.
SQL> alter database recover managed standby database disconnect from session;
Database altered.
SQL> select inst_id, process, status, thread#, sequence#, block#, blocks from gv$managed_standby where process in ('RFS','LNS') or process like 'MR%';
INST_ID PROCESS STATUS THREAD# SEQUENCE# BLOCK# BLOCKS
---------- --------- ------------ ---------- ---------- ---------- ----------
1 MRP0 APPLYING_LOG 2 86 0 0
2 RFS IDLE 0 0 0 0
2 RFS IDLE 0 0 0 0
2 RFS IDLE 1 96 194 1
2 RFS IDLE 0 0 0 0
2 RFS IDLE 0 0 0 0
2 RFS IDLE 0 0 0 0
7 rows selected.
SQL> /
INST_ID PROCESS STATUS THREAD# SEQUENCE# BLOCK# BLOCKS
---------- --------- ------------ ---------- ---------- ---------- ----------
1 MRP0 WAIT_FOR_LOG 1 96 0 0
2 RFS IDLE 0 0 0 0
2 RFS IDLE 0 0 0 0
2 RFS IDLE 1 96 238 1
2 RFS IDLE 0 0 0 0
2 RFS IDLE 0 0 0 0
2 RFS IDLE 0 0 0 0
7 rows selected.