Friday, March 18, 2011

Rman DR datafile restore and doing an Incremental restore.

###################
BACKUP OF DATAFILE RMAN
###################

rman  @rman_backup_database_ARUN1_dbf#9.rman
connect target /
CONFIGURE DEFAULT DEVICE TYPE TO 'DISK';
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET;
run
{
allocate channel db_ch1 type DISK PARMS="BLKSIZE=1048576" format '/fisc/oracle/backup/d-db_01_ch1_%d_%T_%t_%s_%c_%p' ;
setlimit channel db_ch1 maxopenfiles 8;
backup datafile 9;
}
CONFIGURE DEVICE TYPE DISK CLEAR;
exit;
rman > catalog backuppiece '/fisc/oracle/backup/d-db_01_ch1_ARUN1_20101109_734618278_9262_1_1';
rman > list backup of datafile 9 device type DISK;
##############################
Taking incremental backup of the database
##############################
rman @rman_backup_database_ARUN1.rcv trace rman_backup_database_ARUN1.log
 more rman_backup_database_ARUN1.rcv
connect target /
CONFIGURE DEFAULT DEVICE TYPE TO 'DISK';
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET;
run
{
allocate channel db_ch1 type DISK PARMS="BLKSIZE=1048576" format '/fisc/oracle/backup/d-db_01_ch1_%d_%T_%t_%s_%c_%p' ;
setlimit channel db_ch1 maxopenfiles 8;
allocate channel db_ch2 type DISK PARMS="BLKSIZE=1048576" format '/fisc/oracle/backup/d-db_02_ch1_%d_%T_%t_%s_%c_%p' ;
setlimit channel db_ch2 maxopenfiles 8;
allocate channel db_ch3 type DISK PARMS="BLKSIZE=1048576" format '/fisc/oracle/backup/d-db_03_ch1_%d_%T_%t_%s_%c_%p' ;
setlimit channel db_ch3 maxopenfiles 8;
allocate channel db_ch4 type DISK PARMS="BLKSIZE=1048576" format '/fisc/oracle/backup/d-db_04_ch1_%d_%T_%t_%s_%c_%p' ;
setlimit channel db_ch4 maxopenfiles 8;
backup
incremental level 1 cumulative
database not backed up since time 'sysdate - 0/24'
TAG TAG20101109T123257
filesperset 8;
sql 'alter system archive log current';
backup current controlfile;
}
CONFIGURE DEVICE TYPE DISK CLEAR;
sql 'alter session set optimizer_mode=RULE';
exit;
######################################
##############################################
##############################################
restore the datafile and restore from incremantal backup
##############################################
run
{
allocate channel ch1 type DISK;
set newname for datafile 9 to '/dev/roARUN1DT16';
restore datafile 9;
switch datafile 9;
release channel ch1;
}
rm d-db_01_ch1_ARUN1_20101109_734618278_9262_1_1
standby rman > catalog backuppiece '/fisc/oracle/backup/*';
catalog backuppiece '/fisc/oracle/backup/d-db_01_ch1_ARUN1_20101109_734620070_9263_1_1';
catalog backuppiece '/fisc/oracle/backup/d-db_02_ch1_ARUN1_20101109_734620070_9264_1_1';
catalog backuppiece '/fisc/oracle/backup/d-db_03_ch1_ARUN1_20101109_734620070_9265_1_1';
catalog backuppiece '/fisc/oracle/backup/d-db_04_ch1_ARUN1_20101109_734620070_9266_1_1';
catalog backuppiece '/fisc/oracle/backup/d-db_01_ch1_ARUN1_20101109_734624845_9267_1_1';
nohup rman.ksh &
rman target / @recover_db_ARUN1.rcv trace recover_db_ARUN1.log
rman.rcv
run
{
allocate channel ch1 type DISK;
allocate channel ch2 type DISK;
allocate channel ch3 type DISK;
allocate channel ch4 type DISK;
recover database from tag 'TAG20101109T123257';
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
}
rman_watch
nohup scp d-db_02_ch1_ARUN1_20101109_734620070_9264_1_1 oracle@ahyd1:/fisc/oracle/backup > /dev/null 2>&1
nohup scp d-db_03_ch1_ARUN1_20101109_734620070_9265_1_1 oracle@ahyd1:/fisc/oracle/backup > /dev/null 2>&1
nohup scp d-db_04_ch1_ARUN1_20101109_734620070_9266_1_1 oracle@ahyd1:/fisc/oracle/backup > /dev/null 2>&1
nohup scp d-db_04_ch1_ARUN1_20101109_734620070_9266_1_1 oracle@ahyd1:/fisc/oracle/backup 2>&1 &
#################################################################################
Restore script for DR build
#################################
 more rman_restore_fihrp1.rcv
# It is expected that correct control file is available
run
{
#     allocate channel disk1 type disk format '/fisc/dba/rman_backups/%d_%T_%t_%s_%p.save_set';
#
     allocate channel disk1 type disk;
     allocate channel disk2 type disk;
#     restore database from tag 'TAG20080731T141431';
     restore datafile 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19 from tag 'TAG20080731T141431';
}
host "echo Restoring finishing at `date`";

No comments:

Post a Comment