!/bin/ksh
. /export/home/oracle/envs/oracle_env_PNETP
save_date=`date +%Y%m%d%H%M`
# Set ORATAB variable
if [ -f /etc/oratab ] ; then
ORATAB=/etc/oratab
else
if [ -f /var/opt/oracle/oratab ] ; then
ORATAB=/var/opt/oracle/oratab
else
echo “”
echo “`date` Cannot find oratab!”
echo “”
exit 2
fi
fi
export ORATAB
# search the alert log for errors for all databases
#
for ORACLE_SID in `grep -v “^#” $ORATAB | grep -v “^$” | grep -v “*” | grep -v “BLINK” | grep -v “BLOOM” | grep -v “BLINKTEST” | grep -v “B80
6″ | cut -d: -f1`
do
ALERTLOG=${ORA_BDUMP}/alert_${ORACLE_SID}.log
TEMPLOG=/export/home/oracle/scripts/log/alert_tmp_${ORACLE_SID}.log
# Age the alert log
#
mv ${ALERTLOG} $ORA_BDUMP/alert_$ORACLE_SID.log_$save_date
#
touch ${ALERTLOG}
rm ${TEMPLOG}
touch ${TEMPLOG}
# purge all alert logs older than 2 weeks
#
find $ORA_BDUMP/alert* -mtime +14 -exec rm {} ;
#
done