Sunday, April 3, 2016

Shell Script for Scheduled RMAN Backup

The script will first automatically create the directory and will move the old backup into it then will perform the fresh backup.

The script will manage the full backup of database (Noarchivelog). If you need you can slightly change the scripts to perform datafiles as well as archivelog backup.


################ SHELL SCRIPT FOR RMAN SCHEDULED BACKUP#################
cd /home/oraback
mkdir 'date '+%d%m%y''
mv * /home/oraback/'date '+%d%m%y''
cd /d01/oravis/db/tech_st/11.1.0
. VIS_sadhan.env
rman target /
@/home/oravis/rman_bkp.sql
EOF

rman_bkp.sql
run
{
allocate channel d1 type disk MAXPIECESIZE 5G;
allocate channel d2 type disk MAXPIECESIZE 5G;
backup full tag full_db format '/home/oraback/db_%t_%s_p%p'
(database);
release channel d1;
release channel d2;
BACKUP CURRENT CONTROLFILE FORMAT '/home/oraback/CTL%s_%t_%p';
SQL 'ALTER SYSTEM ARCHIVE LOG CURRENT';
}

No comments:

Post a Comment