[oracle@shanxi ORCL]$ cat /home/oracle/admin/del_bdump2.sh
#!/bin/bash
#Author:chipengfei
#Date:2012-11-15
. /home/oracle/.bash_profile
log=/home/oracle/oracle_log/del_bdump2.log
flag=`ps -ef | grep ora_ | grep -v 'grep'`
if [ -z "$flag" ] ; then
exit
fi
echo ------------
now=`date "+%Y-%m-%d %H:%M:%S"`
echo "----------------------------$now-------------------------------" >> $log
bg_list=`ps -ef | grep -i ora_ | grep -v 'grep' | awk '{print $2}'`
filter=''
for i in $bg_list ; do
filter="${filter}|_${i}.trc"
done
filter2=`echo $filter | sed 's/^|//'`
cd $ORACLE_BASE/admin/$ORACLE_SID/bdump
ls | grep '.trc' | egrep -v "${filter2}" >> $log
ls | grep '.trc' | egrep -v "${filter2}" | xargs -n 5 rm -rf
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/27042095/viewspace-750058/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/27042095/viewspace-750058/