Wednesday, December 19, 2007

rman to restore archivelog from backupset and synch a standby db

To list the backup sets of the archive logs. Where or which
sets we have the archive logs.

RMAN>
list backup of archivelog logseq 5594;

BP Key: 1292331 Status: AVAILABLE Compressed: NO Tag: MANUAL_HOT_BKP_AL_ON_1213071620
Piece Name: /obackup/oracle/mtrx/hot/q4j3gsbs_1_1

List of Archived Logs in backup set 1292328
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 5594 21533054412 13-DEC-07 21533150295 13-DEC-07

cd /obackup/oracle/mtrx/hot/
ls -l | grep -v mtrx

will show all the files and rsync to the standby server:

for x in `ls -l | grep -v mtrx`
do
rsync -avvzrlpogt --stats --progress --rsync-path=/opt/csw/bin/rsync \
$x -e ssh oracle@asb-con-dbs-001:/obackup/oracle/mtrx/hot/
done

NOW on the standby server: asb-con-dbs-001

RMAN> list backup of archivelog sequence between 5594 and 5884;

Allow Rman to recover the database it will restore the archive
logs in the original place it picked them up.
you can verify by using ls -l /metrix/archlogs01/oracle/

Now to remove the old archive logs from standby db using rman:
DELETE noprompt ARCHIVELOG ALL BACKED UP 1 TIMES TO DEVICE TYPE disk;

No comments: