Rman 定時備份crontab

beatony發表於2010-05-18

第一步:加入定時任務:

crontab - l

10 0 * * * /oradata_uat8/udb001/backup_db.sh  >  /oradata_uat8/udb001/b.log


// 每天凌晨0:10自動備份資料庫。

第二步: shell 檔案呼叫backup scripts. 

backup_db.sh

#!/bin/sh
export ORACLE_HOME=/apps/ude/oracle/product/10.2.0/database
export PATH=$ORACLE_HOME/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:.
export ORACLE_BASE=/apps/ude/oracle
export PATH=$PATH:$ORACLE_HOME/bin:/$ORACLE_HOME/OPatch
export ORACLE_SID=udb001

cd /oradata_uat8/udb001/archive
rman target / CMDFILE udb_rman.rcv 

第三步:Rman backup scripts.

udb_rman.rcv

#!/bin/sh
sql 'alter system switch logfile';
crosscheck archivelog all;
delete noprompt expired archivelog all;
crosscheck backup;
delete noprompt obsolete; 
delete expired copy;
run{
 allocate channel c1 type disk;
 allocate channel c2 type disk;
 allocate channel c3 type disk;
 allocate channel c4 type disk;
 allocate channel c5 type disk;
 allocate channel c6 type disk;
 allocate channel c7 type disk;
 allocate channel c8 type disk;
 backup database format '/oradata_uat8/udb001/rman/full_level0_%U';
 backup archivelog all delete all input skip inaccessible format '/oradata_uat8/udb001/rman/ARC_%U';
 backup current controlfile format '/oradata_uat8/udb001/rman/control_bak_%T';
 release channel c1;
 release channel c2;
 release channel c3;
 release channel c4;
 release channel c5;
 release channel c6;
 release channel c7;
 release channel c8;
 }

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22578826/viewspace-663037/,如需轉載,請註明出處,否則將追究法律責任。

相關文章