Wednesday, December 19, 2012

Restore & Recovery using rman

##################################
#####
##### Restore & Recovery Template
#####
##################################
#####
##### restore & recovery of an ORACLE database with RMAN from a SAT Backup: regular
#####
#####
#
#
##### restore & recovery for database with DBID
#set DBID=1234;
#
#
#####
##### restore spfile from database backupset
#####
##run {
##
##   startup nomount force;
##
##   allocate channel RESTORE_SPFILE type sbt_tape parms 'ENV=(TDPO_OPTFILE=/sysmgmt/sat/backup/etc/tsm/tdpo_servername.dbname.dbname_IMAGE.opt)' format 'DB-%d_BUSet-%uPieceNo-%p_CopyNo-%c';
##   restore spfile from tag='R_201210110621_ALL_ONLI_T';
##   release channel RESTORE_SPFILE;
##   shutdown abort;
##
##}
#
#
##### set database incarnation for restores
#reset database to incarnation 213545;
#
#
#####
##### restore controlfile from controlfile backupset
#####
##run {
##
##    startup nomount force;
##
##   allocate channel RESTORE_CONTROL type sbt_tape parms 'ENV=(TDPO_OPTFILE=/sysmgmt/sat/backup/etc/tsm/tdpo_servername.dbname.dbname_IMAGE.opt)' format 'DB-%d_BUSet-%uPieceNo-%p_CopyNo-%c';
##   restore controlfile from tag='R_201210110621_ALL_ONLI_C';
##   release channel RESTORE_CONTROL;
##   alter database mount;
##   shutdown abort;
##
##}
#####
##### restore and recover tablespaces from database backupset and archivelog backupsets
#####
#run {
#
#    startup mount force;
#
##### if an incomplete recovery has to be done ...
##    set until time ="to_date('2008-12-32 12:00:00','yyyy-mm-dd hh24:mi:ss')";
##    set until scn ;
##    set until sequence thread ;
###### channel allocation for the restore of the datafiles
#    allocate channel RESTORE_DATA_1 type sbt_tape parms 'ENV=(TDPO_OPTFILE=/sysmgmt/sat/backup/etc/tsm/tdpo_servername.dbname.dbname_IMAGE.opt)' format 'DB-%d_BUSet-%uPieceNo-%p_CopyNo-%c';
#    allocate channel RESTORE_DATA_2 type sbt_tape parms 'ENV=(TDPO_OPTFILE=/sysmgmt/sat/backup/etc/tsm/tdpo_servername.dbname.dbname_IMAGE.opt)' format 'DB-%d_BUSet-%uPieceNo-%p_CopyNo-%c';
#
##### channel allocation for the restore of the archivelogs
#    allocate channel RESTORE_LOGS_1 type sbt_tape parms 'ENV=(TDPO_OPTFILE=/sysmgmt/sat/backup/etc/tsm/tdpo_servername.dbname.dbname_ARCHIVELOG_PRIMARY.opt)' format 'DB-%d_BUSet-%uPieceNo-%p_CopyNo-%c';
#    allocate channel RESTORE_LOGS_2 type sbt_tape parms 'ENV=(TDPO_OPTFILE=/sysmgmt/sat/backup/etc/tsm/tdpo_servername.dbname.dbname_ARCHIVELOG_SECONDARY.opt)' format 'DB-%d_BUSet-%uPieceNo-%p_CopyNo-%c';
#
#
##### validation if the restore and recovery could be done
#    restore database validate;
#
##### restore the datafiles
#    restore database;
#
#
##### recover the database
#    recover database;
##### optionally: delete logs restored for recovery to limit used disk space
##    recover database delete archivelog maxsize 128m;
#
#
##### release archivelog restore channel(s)
#    release channel RESTORE_LOGS_2;
#    release channel RESTORE_LOGS_1;
#
##### release datafile restore channel(s)
#
#}
#
#
##### open the database if a complete recovery was done ...
##alter database open;
#
##### open the database if an incomplete recovery was done ...
##alter database open resetlogs;
#
#####
#####
##### Don't forget to check the temporary tablespaces and their tempfiles !!!
#####
##### Also check & restore files which were not part of RMAN backups (password file, listener.ora, ...)

No comments: