Oracle定期タスク:RMAN
1,Create a RMAN script named rman.bkp to do the task.
[oracle@CentOS53 Oracle_Scripts]$ more rman.bkp CONFIGURE CONTROLFILE AUTOBACKUP ON; configure channel device type disk format='/u01/oracle/app/admin/o11g2/backups/full_db_%U'; configure retention policy to redundancy 2; run{ ALLOCATE CHANNEL RMAN_BACK_CH01 TYPE DISK; CROSSCHECK BACKUP; crosscheck archivelog all; delete expired archivelog all; sql'ALTER SYSTEM ARCHIVE LOG CURRENT'; backup as backupset database plus archivelog delete all input; DELETE NOPROMPT OBSOLETE; DELETE NOPROMPT EXPIRED BACKUP; RELEASE CHANNEL RMAN_BACK_CH01; } exit;
2,Create a shell script to call the rman script.
[oracle@CentOS53 Oracle_Scripts]$ more exec_rman.sh export ORACLE_SID=o11g2 export ORACLE_BASE=/u01/oracle/app export ORACLE_HOME=/u01/oracle/app/product/11.2.0/dbhome_1 /u01/oracle/app/product/11.2.0/dbhome_1/bin/rman target / \ @/u01/oracle/Oracle_Scripts/rman.bkp \ log=/u01/oracle/Oracle_Scripts/rman.log.$$ nocatalog exit
3,Put the shell script into the crontab schedule.
[oracle@CentOS53 Oracle_Scripts]$ crontab -l 05 4 * * * /u01/oracle/Oracle_Scripts/exec_rman.sh >/dev/null 2>&1