Delete Dataguard Archivelog

ygzhou518發表於2011-12-07

真實環境下的archivelog delete指令碼:

PrimaryDB:

crontab -l

00 12 * * * sh /data1/fullbackup/rman_del/rman_del.sh          ------------------此時DB負載相對較小

strings rman_del.sh

PATH=$PATH:$HOME/bin
export PATH
unset USERNAME
export TMPDIR=/tmp
export ORACLE_BASE=/home/oracle
export ORACLE_SID=hmddb1
export ORACLE_HOME=/home/oracle/product/11.2.0/dbhome_1
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/openwin/lib:/usr/local/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlib
export JAVA_HOME=/home/oracle/jre/1.1.8
export JAVA_BINDIR=$JAVA_HOME/bin
export SDK_HOME=$JAVA_HOME
export JDK_HOME=$JAVA_HOME
export PATH=$ORACLE_HOME/bin:$PATH
export NLS_LANG=AMERICAN_AMERICA.ZHT16BIG5
#export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export THREADS_FLAG=native
rman target / log=/data1/fullbackup/rman_del/rman_del.log.`date +%Y%m%d%H%M%S` @/data1/fullbackup/rman_del/rman_del.run                  --------------利用RMAN刪除歸檔的日誌,另外還可以通過判斷archivelog是否被 standby應用來清理

strings rman_del.run

DELETE NOPROMPT ARCHIVELOG until time 'sysdate-7;              ------------------------------------主庫儲存規劃為1.5TB    每日的archivelog大約在50G

 

StandbyDB:

crontab -l

00 17:20 * * * sh /home/oracle/admin/rman_del.sh

strings rman_del_sh

PATH=$PATH:$HOME/bin
export PATH
unset USERNAME
export TMPDIR=/tmp
export ORACLE_BASE=/home/oracle
export ORACLE_SID=hmddb1
export ORACLE_HOME=/home/oracle/product/11.2.0/dbhome_1
export TNS_ADMIN=$ORACLE_HOME/network/admin
export PATH=$ORACLE_HOME/bin:$PATH
export NLS_LANG=AMERICAN_AMERICA.ZHT16BIG5
#export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export THREADS_FLAG=native
rman target / log=/home/oracle/admin/rman_del.log @/home/oracle/admin/rman_del.run

strings rman_del.run

DELETE NOPROMPT ARCHIVELOG until time 'sysdate-15;       ------------------------------------------standby儲存規劃為3T,fullbackup 保留2份,archivelog保留半個月(另外histDB 2TB)

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

相關文章