rman定时备份脚本

增量备份incrl.sh

export ORACLE_SID=DEV
export ORACLE_BASE=/oracle
export ORACLE_HOME=/oracle/DEV/112_64
/oracle/DEV/112_64/bin/rman target / << EOF
run {
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
allocate channel c5 device type disk;
allocate channel c6 device type disk;
allocate channel c7 device type disk;
allocate channel c8 device type disk;
allocate channel c9 device type disk;
allocate channel c10 device type disk;
allocate channel c11 device type disk;
allocate channel c12 device type disk;
allocate channel c13 device type disk;
allocate channel c14 device type disk;
allocate channel c15 device type disk;
allocate channel c16 device type disk;   
CONFIGURE COMPRESSION ALGORITHM 'HIGH';
backup incremental level 1  as compressed backupset format='/oracle/DEV/sapbackup/%d_%U.bak' database plus archivelog;
backup incremental level 1  as compressed backupset format='/oracle/DEV/sapbackup/spfile_%U.bak' spfile;
backup incremental level 1  as compressed backupset format='/oracle/DEV/sapbackup/ctl_%U.bak' current controlfile;
crosscheck archivelog all;  
release channel c1; 
release channel c2; 
release channel c3; 
release channel c4; 
release channel c5; 
release channel c6; 
release channel c7; 
release channel c8; 
release channel c9; 
release channel c10; 
release channel c11; 
release channel c12; 
release channel c13; 
release channel c14; 
release channel c15; 
release channel c16; 
}

完全备份fullbackup.sh

export ORACLE_SID=DEV
export ORACLE_BASE=/oracle
export ORACLE_HOME=/oracle/DEV/112_64
/oracle/DEV/112_64/bin/rman target / << EOF
run {
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
allocate channel c5 device type disk;
allocate channel c6 device type disk;
allocate channel c7 device type disk;
allocate channel c8 device type disk;
allocate channel c9 device type disk;
allocate channel c10 device type disk;
allocate channel c11 device type disk;
allocate channel c12 device type disk;
allocate channel c13 device type disk;
allocate channel c14 device type disk;
allocate channel c15 device type disk;
allocate channel c16 device type disk;   
CONFIGURE COMPRESSION ALGORITHM 'HIGH';
backup  as compressed backupset format='/oracle/DEV/sapbackup/%d_%U.bak' database plus archivelog;
backup  as compressed backupset format='/oracle/DEV/sapbackup/spfile_%U.bak' spfile;
backup  as compressed backupset format='/oracle/DEV/sapbackup/ctl_%U.bak' current controlfile;
crosscheck archivelog all;  
release channel c1; 
release channel c2; 
release channel c3; 
release channel c4; 
release channel c5; 
release channel c6; 
release channel c7; 
release channel c8; 
release channel c9; 
release channel c10; 
release channel c11; 
release channel c12; 
release channel c13; 
release channel c14; 
release channel c15; 
release channel c16; 
}

定时脚本
备份计划,周日1:30全备,周一至周六1:50增量备份
crontab -e

30 1 * * 0  /oracle/DEV/scripts/fullbackup.sh >> /oracle/DEV/scripts/fullbackup.log
50 1 * * 1-6   /oracle/DEV/scripts/incrl.sh >> /oracle/DEV/scripts/incrl.log

crontab不执行脚本,手动调测又没有任何问题

解决方法:

   1.确保自己的脚本没有问题,可以手动测试通过
   2.不要在浪费时间了,直接打开/var/spool/mail/登陆用户名,里面有详细的报错日志,而且一定是有的。
   3.对着报错问题,就好办了,一切根据问题,找解决方法。

你可能感兴趣的:(rman定时备份脚本)