grid trc 文件快速清理脚本

12.2.0.1.0 TRACE 文件

export ORACLE_HOME=/u01/app/12.2.0/grid
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
find /u01 -name "*trc" |awk -F "/" '{$NF="";print}'| sed 's#\s#\/#g'|uniq|while read line; do du -sh $line; done|grep G
find /u01 -name "*aud" |awk -F "/" '{$NF="";print}'| sed 's#\s#\/#g'|uniq|while read line;do  du -sh  $line ; done|grep G
ps -ef|grep tnsl|grep -v grep| awk '{print $9}'|while read line;do lsnrctl status $line|grep "Listener Log File"; done|awk '{print $4}'|while read line; do du -sh $(echo $line|awk -F "/" '{$NF="";print}' |sed 's#\s#\/#g'); done
[root@odsRAC1 its]# sh chk.sh 
3.1G    /u01/app/grid/diag/crs/odsrac1/crs/trace/
633M    /u01/app/grid/diag/rdbms/_mgmtdb/-MGMTDB/trace/
2.5G    /u01/app/12.2.0/grid/rdbms/audit/
1.1G    /u01/app/grid/diag/tnslsnr/odsRAC1/asmnet1lsnr_asm/alert/
76M    /u01/app/grid/diag/tnslsnr/odsRAC1/listener/alert/

aud 文件清理:

[root@odsRAC1 audit]# du -sh
2.5G    .
[root@odsRAC1 audit]# pwd
/u01/app/12.2.0/grid/rdbms/audit
[root@odsRAC1 audit]# find /u01/app/12.2.0/grid/rdbms/audit -mtime +1 -name "*aud" |xargs rm -rf "*aud" 
[root@odsRAC1 audit]# du -sh
19M    
上一篇:定期清理sql2005事务日志


下一篇:mysql简单的碎片清理脚本