Oracle 11g 自動刪除ASM歸檔檔案指令碼

tolywang發表於2010-12-16

[root@wsjrac01 ~]# cat    /u01/run/autodel
#!/bin/bash

find /u01/product/grid/crs/diag/asm/+asm/+ASM1/trace/*.trc -mtime +2 -exec rm -f {} \;

find /u01/product/grid/crs/diag/asm/+asm/+ASM1/trace/*.trm -mtime +2 -exec rm -f {} \;


find /u01/product/oracle/diag/rdbms/wsjdell/wsjdell1/trace/*.trc -mtime +2 -exec rm -f {} \;

find /u01/product/oracle/diag/rdbms/wsjdell/wsjdell1/trace/*.trm -mtime +2 -exec rm -f {} \;

find /u01/product/oracle/admin/wsjdell/adump/*.aud -mtime +1 -exec rm -f {} \;


[root@wsjrac01 ~]# su - grid
wsjrac01$


wsjrac01$crontab -l
30 23 * * * sh /u01/run/del_arch_5.sh 1>>/u01/run/log/del_arch_5.log 2>>/u01/run/log/del_arch_5.bad
wsjrac01$cat /u01/run/del_arch_5.sh
#!/bin/bash

export ORACLE_HOME=/u01/product/grid/11.2.0
export ORACLE_SID=+ASM1

dirname=`date -d "5 days ago" +%Y_%m_%d`
 
/u01/product/grid/11.2.0/bin/asmcmd <cd data/
cd wsjdell/
cd ARCHIVELOG/
ls -l
rm -rf $dirname
ls -l
exit
EOF
wsjrac01$

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

相關文章