Unix/Linux下,Oracle備份策略一例

qdrzq發表於2014-05-26

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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章