Somberi Techblog
 
Read this Disclaimer first
Techblog Home
All Entries
About Techblog
This weblog is licensed under
a Creative Commons License
Hosted by Somberi.com
Powered by Movable Type
Tech Blog

RMAN Disaster Recovery script (rman_dr.ksh) - Ramakrishna Nemani

This script is intended to provide a mechanism for disaster recovery. Output log of this script is given as another entry  which you can check

#!/bin/ksh
. ~/.profile
##
## script name : rman_dr.ksh
## Author : Ramakrishna Nemani
##
## Purpose :
## This script is for restoring the complete database from tape. This could be used
## after a disaster to do a disaster recovery. It assumes that a new unix box has
## been set up and Oracle software has been installed and all the directory structures
## have been restored by the UNIX admins. This script does not use rman recovery catalog.
##
## Note :
## You have to replace the DBID value with the DBID that you are attempting to restore and recover
## You need to login as a unix user id that belongs to the dba group and run this script
## I have tested this script only on Oracle 10g on an IBM AIX platform. Use it at your own risk.
##
## This is an example or sample script
##

rman << EOF > ./cmad_dr.log

CONNECT TARGET /

STARTUP FORCE NOMOUNT;

##
## set dbid because we are not using an rman recovery catalog
##
SET DBID 1522268517 ;

##
## Specify AUTOBACKUP Format
##
SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F';
##
## Restore spfile from autobackup first
##
RUN {
ALLOCATE CHANNEL tape_1 DEVICE TYPE sbt
PARMS 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)'
FORMAT '%u_%p_%c' ;
RESTORE SPFILE FROM AUTOBACKUP  ;
}
##
## Restart the database with newly restored SPFILE
##
SHUTDOWN IMMEDIATE;
STARTUP NOMOUNT;

##
## Now restore controlfile from autobackup
##
RUN {
ALLOCATE CHANNEL tape_1 DEVICE TYPE sbt
PARMS 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)'
FORMAT '%u_%p_%c' ;
RESTORE CONTROLFILE FROM AUTOBACKUP ;
}

##
## Mount the database, restore and recover
##
ALTER DATABASE MOUNT ;

RUN {
ALLOCATE CHANNEL tape_1 DEVICE TYPE sbt
PARMS 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)'
FORMAT '%u_%p_%c' ;
RESTORE DATABASE  ;
RECOVER DATABASE  ;
}
##
## Open the database, if restore and recover are successful
##

EOF

 


TrackBack

TrackBack URL for this entry:
http://www.somberi.com/nrk-mt/mt-tb.fcgi/48

Post a comment

(Your comment may need to be approved before it will appear on the site. Thanks for waiting)