Thursday, April 5, 2012

One night restoring Oracle Database 10g from archive log with RMAN

The following is an RMAN (Oracle Recovery Manager) script used this night to restore the archive logs from a RMAN backup.


The catalog is located on a different machine. The backup is on tapes like the one below.


DLT Tape


We needed to restore only the archives from sequence number 409237 to 409287 to recover a corrupted datafile.


We specified a different location for the restored archived logs rather than the original one with "set archivelog destination to 'location'" command.


Have fun! (actually IF you have to restore archive logs you are NOT going to have fun hehe).


[oracle@host-a ~]$ rman
Recovery Manager: Release 10.2.0.4.0 - Production on Thu Apr 5 01:17:57 2012


Copyright (c) 1982, 2007, Oracle.  All rights reserved.


RMAN> connect target /connected to target database: DBSID (DBID=2456460023)
RMAN> connect catalog user/password@catalog-hostconnected to recovery catalog database
RMAN> run {
allocate channel 'dev_0' type 'sbt_tape' parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=DBSID,OB2BARLIST=DBSID_Archive_A)';
set archivelog destination to '/home/oracle/ora-archive/DBSID/tmp';
restore archivelog from logseq=409237 until logseq=409287 thread=1;
release channel 'dev_0';
}


No comments:

Post a Comment