1.
crontab 建操作系统下的调度
10 2 * * */rman/scripts/bak_full.sh
表示每天2:10调度,五个参数分别是 分钟 小时 日 月 周(0-6,0表示周日)
2.
bak_full.sh的内容:
#!/bin/sh
su - oracle -c "sh /arch/scripts/full.sh"
3.
full.sh的内容:
DATE='date+%Y-%m-%d'
export ORACLE_SID=ORCL
rman target / cmdfile=/rman_scripts.sh log=/.../log_rman_$DATE
4.
rman_scripts.sh的内容大致是:
alter system archivelog current;
backup database plus archivelog;
run{...
}
delete obsolete;
delete ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';
具体是:
run {
allocate channel d1 type disk maxpiecesize= 2G;
sql 'alter system archive log current';
backup database
format '/arch/%d_db_%T_%s_%u_%p'
plus archivelog
format '/arch/%d_arch_%T_%s_%u_%p';
release channel d1;
}
delete noprompt obsolete;
DELETE noprompt ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29512902/viewspace-1170401/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29512902/viewspace-1170401/