Monday, February 06, 2012

RMAN Restore from Consistent and Inconsistent BACKUP


RMAN Restore from Inconsistent BACKUP

# start of script
# change DBID  ###
# change NB_ORA_CLASS as appropriate ###
# change set option as appropriate  ###

set echo on;
host 'echo Starting restore at $(date).';
set DBID = DBID;

startup nomount;


run {

  allocate channel t1 type sbt
    parms='ENV=(NB_ORA_CLASS=RMAN_Tier3)';
  allocate channel t2 type sbt
    parms='ENV=(NB_ORA_CLASS=RMAN_Tier3)';

# restore controlfile from autobackup maxseq 0;
# restore controlfile from 'c-1232717171-040130-00';
# restore controlfile from ‘/bkup/oracle/backup_controlfile.1223’
  restore controlfile from autobackup;

  alter database mount;

# set until scn 1239965260;
# set until time "to_date('01-28-2004 11:40:54','mm-dd-yyyy hh24:mi:ss')";

  restore database;
  recover database;

  alter database open resetlogs;
}
host 'echo Ending restore at $(date).';
# end of script


RMAN Restore from Consistent BACKUP

# start of script
# change DBID ##
# change NB_ORA_CLASS as appropriate  ###

set echo on;
host 'echo Starting restore at $(date).';
set DBID = DBID;

startup nomount;


run {
  allocate channel t1 type sbt
    parms='ENV=(NB_ORA_CLASS=RMAN_MTBackup_Tier3)';
  allocate channel t2 type sbt
    parms='ENV=(NB_ORA_CLASS=RMAN_MTBackup_Tier3)';
  set command id to 'rman restore';

#  in noarchivelog mode, no set means most current backup.
# set until scn 562449965260;
# set until time "to_date('01-30-2004 13:00:00','mm-dd-yyyy hh24:mi:ss')";

# restore controlfile from autobackup maxseq 0;
# restore controlfile from 'c-1232717171-040130-00';
# restore controlfile from ‘/bkup/oracle/backup_controlfile.1223’
  restore controlfile from autobackup;

  alter database mount;

  restore database;
  recover database noredo;

  alter database open resetlogs;
}
host 'echo Ending restore at $(date).';
# end of script

Hope this helps!  Rupam