Friday, January 20, 2017

Stepwise taking RMAN Incremental Cumulative L1 backup(Linux Server)

Stepwise taking RMAN Incremental Cumulative L1 backup(Linux Server)
 
Step 1
---------
Create an rcv file on server.
 
vi rman_incr_L1.rcv
 
Step 2
---------
Enter the following command in rcv file and save it (wq! used to save the file)
 
run {
allocate channel c1 type disk format='/RMAN/Full_BKP/Full_bkp_L1_%d_%s_%t_%U';
allocate channel c2 type disk format='/RMAN/Full_BKP/Full_bkp_L1_%d_%s_%t_%U';
allocate channel c3 type disk format='/RMAN/Full_BKP/Full_bkp_L1_%d_%s_%t_%U';
allocate channel c4 type disk format='/RMAN/Full_BKP/Full_bkp_L1_%d_%s_%t_%U';
backup as compressed backupset incremental level 1 cumulative database;
delete noprompt archivelog all completed before 'sysdate -.25' backed up 0 times to disk;
crosscheck archivelog all;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}
exit;
 
 
this run block will the Incremental Rman L1 cumulative backup and delete the achivelog.
 
Step 3
---------
take the path where rcv file is created.
 
pwd (command is used for that)
 
Step 4
---------
 
Setup the env. and Run the rcv file from nohup
 
export ORACLE_SID=instance_name
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1
export PATH=$PATH:/u01/app/oracle/product/11.2.0.4/dbhome_1/bin
DT=$(date +"%F")
nohup /u01/app/oracle/product/11.2.0.4/dbhome_1/bin/rman target / cmdfile=/RMAN/scripts/rman_incr_L1.rcv log=/RMAN/scripts/rman_incr_L1_$DT.log &
 
 
 
Optional Step: (Schedule it in crontab)
 
Step 1
---------
create a shell script like RMAN_INCR_L1.sh and put the following entry and save it
 
for example I have create the RMAN_INCR_L1.sh script in /u01/app/oracle/scripts
 
vi rman_incr_L1.sh
 
export ORACLE_SID=instance_name
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1
export PATH=$PATH:/u01/app/oracle/product/11.2.0.4/dbhome_1/bin
DT=$(date +"%F")
nohup /u01/app/oracle/product/11.2.0.4/dbhome_1/bin/rman target / cmdfile=/RMAN/scripts/rman_incr_L1.rcv log=/RMAN/scripts/rman_incr_L1_$DT.log &
 
 
step 2
----------
Invoke crontab editor
 
crontab -e and edit it like below
 
00 18 * * 1,2,3,4,5,6 sh /u01/app/oracle/scripts/RMAN_INCR_L1.sh >> /u01/app/oracle/scripts/RMAN_INCR_L1.log
 
 
This will allow the script to run on every night at 6 PM server time zone