Friday, June 21, 2013

11gR2 Database Point In Time Recovery to new Host using Recovery Catalog

The follwoing scenario recovers the DB from the tape backup to an another Host. In order to use the procedure you must have a recovery catalog database which does not requires a connection to the target DB. Tape Librabry parmeters here are using a Legato Client , Consult your tape library provider for the correct ones.

1. On the new host all the DB

- Ensure connectivity between the new host and the RMAN catalog DB through TNS
- Ensure sufficient space for the recovery
- If the primary DB uses a Block Change Tracking file please copy it on the same location the ne new host , or create a dummy file on the smae location and name
- Perform the following actions as the Oracle User:

export ORACLE_SID=aux
rman auxiliary / catalog user@db/pass
RMAN> startup clone nomount;
RMAN> run {
allocate auxiliary channel ch1 DEVICE TYPE 'SBT_TAPE' PARMS  'ENV=(NSR_SERVER=myserver,NSR_CLIENT=myclient,NSR_DATA_VOLUME_POOL=oracledb)';
duplicate database PRIMARY dbid 2648977915 to AUX
UNTIL TIME "to_date('13/06/2013 00:00:00', 'DD/MM/YYYY HH24:MI:SS')"
db_file_name_convert 'primary','aux'
spfile
parameter_value_convert 'primary','aux'
set log_file_name_convert 'primary','aux';
 }

2. On the new host specific tablespaces DB

- Ensure connectivity between the new host and the RMAN catalog DB through TNS
- Ensure sufficient space for the recovery
- If the primary DB uses a Block Change Tracking file please copy it on the same location the ne new host , or create a dummy file on the smae location and name
- Perform the following actions as the Oracle User:

export ORACLE_SID=aux
rman auxiliary / catalog user@db/pass
RMAN> startup clone nomount;
RMAN> run {
allocate auxiliary channel ch1 DEVICE TYPE 'SBT_TAPE' PARMS  'ENV=(NSR_SERVER=myserver,NSR_CLIENT=myclient,NSR_DATA_VOLUME_POOL=oracledb)';
duplicate database PRIMARY dbid 2648977915 to AUX
UNTIL TIME "to_date('13/06/2013 00:00:00', 'DD/MM/YYYY HH24:MI:SS')"
tablespace users
db_file_name_convert 'primary','aux'
spfile
parameter_value_convert 'primary','aux'
set log_file_name_convert 'primary','aux';
 }

Both Procedures will restore the spfile and perform file location convertion. If you want to use the same location use the nofilenamecheck as follows :

 run {
allocate auxiliary channel ch1 DEVICE TYPE 'SBT_TAPE' PARMS  'ENV=(NSR_SERVER=myserver,NSR_CLIENT=myclient,NSR_DATA_VOLUME_POOL=oracledb)';
duplicate database PRIMARY dbid 2648977915 to AUX
UNTIL TIME "to_date('13/06/2013 00:00:00', 'DD/MM/YYYY HH24:MI:SS')"
nofilenamecheck
spfile
}

Can can also setup an initfile of your choice and put it on $ORACLE_HOME/dbs. RMAN then will use this file to startup the clone and remove the spfile directive from the command.

Of cource you can do this with disk backups with the same commands allocating Disk Auxiliary Channels and make backups availiable to the new Host.

If you do not have a recovery catalog, you can still perform the operation but only for disk backups. This is achieved via backup location clause of the duplicate command e.g
 run {
allocate auxiliary channel ch1 DEVICE TYPE DISK;
duplicate database PRIMARY dbid 2648977915 to AUX
UNTIL TIME "to_date('13/06/2013 00:00:00', 'DD/MM/YYYY HH24:MI:SS')"
backup location '/backup'
nofilenamecheck
}

REFERENCES
Oracle Support Notes : 1375864.1 , 1113713.1 , 73974.1
Oracle® Database Backup and Recovery Reference 11g Release 2 (11.2)

No comments:

Post a Comment