首页 > Linux操作系统 > Linux操作系统 > 清除oracle log 脚本
#!/bin/ksh
#clear oracle logs,include: 1).core dump; 2).udump; 3).network logs
if [ -z "$1" ]
then
echo "Usage: check_alert_log.sh
exit 99
fi
loop=0
while [ $# -ne 0 ]
do
#echo $1
check=`cat /var/opt/oracle/oratab|grep -i "<$1>"|wc -l`
tmp=`expr $check` # Convert string to number
if [ $tmp -lt 1 ]
then
echo
echo "Not a valid ORACLE_SID. Retry."
echo
exit 99
fi
ORACLE_SID=$1
HOME=/apps/oracle
ORACLE_HOME=`cat /var/opt/oracle/oratab|grep ^$ORACLE_SID:|cut -f2 -d':'`
UDUMP_DEST=$HOME/admin/$ORACLE_SID/udump
CDUMP_DEST=$HOME/admin/$ORACLE_SID/cdump
export HOME ORACLE_SID ORACLE_HOME UDUMP_DEST
#1.clear core dump
cd $ORACLE_HOME/dbs
rm -rf core_*
cd $CDUMP_DEST
rm -rf core_*
#2). clear udump
cd $UDUMP_DEST
find . -name "*.trc" -ctime +3 -print|xargs rm -f
#3). clear network log
cd $ORACLE_HOME/network/log
>listener.log
>sqlnet.log
shift
done
http://ora110.itpub.net/category/33978/56698
<!-- comment these out if you want to see an example of custom fields, but remember to name the fields in the same way they are named here: 'imfeeling' (livejournal.com style), 'listening' and 'new_field': �
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/1700901/viewspace-721181/ ,如需转载,请注明出处,否则将追究法律责任。