Below is to make it easy and efficient using scripting !
Creating a shell script that handles the RMAN backup.
[oracle@oracledb backup]$ cat rman_backup.sh
export ORACLE_SID=hexaprod
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/db_1
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
rman target / nocatalog log=/u01/backup/RMAN_backup.log << EOF
run
{
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
allocate channel ch3 device type disk;
allocate channel ch4 device type disk;
sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
configure retention policy to recovery window of 5 days;
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 4;
CROSSCHECK BACKUP DEVICE TYPE DISK;
CROSSCHECK ARCHIVELOG ALL;
delete noprompt archivelog all backed up 1 times to device type disk;
backup incremental level 0 as compressed backupset database archivelog all tag weekly_Full_backup delete input;
DELETE NOPROMPT OBSOLETE;
DELETE NOPROMPT EXPIRED BACKUP;
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
}
EOF
Use chmod to make our
script executable.
Then schedule the script to run automatically using
crontab.
[oracle@oracledb backup]$ crontab -e
### RMAN Backup ###
00 23 * * * /u01/backup/rman_backup.sh
This way, I set it to run every night at 11:00 PM.
No comments:
Post a Comment