Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: view alert

Re: view alert

From: Trifon Anguelov <trifona_at_pacbell.net>
Date: Thu, 07 Mar 2002 03:03:28 GMT
Message-ID: <4MAh8.216$gY3.113031276@newssvr21.news.prodigy.com>


Titi,

On UNIX you can use this script to rename your alert after every ORA error encountered. Either you can e-mail the whole file to your mailbox or grep only for ORA errors:

#! /bin/ksh

cd $HOME
. ./.env

C_DATE=`date +"%a %b %e "`
C_DATEL=`date +"%d-%b-%y" | nawk -F: '{ print toupper($1)}'  -`
C_HOUR=`date +"%H"`
C_TIME=`date +"%p"`

HOST=`hostname`
DBA='foo_at_skytel.com'
ALERT_LOG=$ORACLE_ADMIN/bdump/alert_$ORACLE_SID.log LISTENER_LOG=$ORACLE_HOME/network/log/listener.log ALERT_SUFFIX=`date +"%m%d%y.%H%M"`

export C_DATE C_DATEL C_HOUR C_TIME HOST DBA ALERT_LOG LISTENER_LOG ALERT_SUFFIX echo "Executing $0 script at `date` "

# Xtract current date records from alert file & scan it for ORA-errors.

> /tmp/temp$$

sed -n "/^$C_DATE/,$ p" ${ALERT_LOG} > /tmp/temp$$ sed -n "/^$C_DATEL/,$ p" ${LISTENER_LOG} >> /tmp/temp$$ #

sed -n '/^ORA-/ p' /tmp/temp$$ > /tmp/tmp_ora_errors_alt sed -n '/^TNS-/ p' /tmp/temp$$ > /tmp/tmp_ora_errors_tns

# create a text body of the text

cat > /tmp/ora_errors <<EOF

Automatic mail message send from host $HOST for oracle instance $ORACLE_SID on `date`

DONOT REPLY FOR THIS MESSAGE..... Please check the follwing files ( will exist if there was an error )

     ${ALERT_LOG}.${ALERT_SUFFIX} ......
     ${LISTENER_LOG}.${ALERT_SUFFIX} .....


`cat /tmp/tmp_ora_errors_alt /tmp/tmp_ora_errors_tns`

# Variable LN_CNT initialized to the no. of lines in the ora_errors file.

LN_CNT_1=`wc -l < /tmp/tmp_ora_errors_alt` LN_CNT_2=`wc -l < /tmp/tmp_ora_errors_tns`

# If ora_errors file has lines in it, then mail is sent to the DBA.

if [[ $LN_CNT_1 -ge 1 || $LN_CNT_2 -ge 1 ]] then
# echo "Sending email ......"

   mailx -s "Please Check the ALERT / LISTENER log in [$ORACLE_SID] for Errors" $DBA < /tmp/ora_errors
 if [[ $? -eq 0 ]]; then

  if [[ $LN_CNT_1 -ge 1 ]]; then

      mv ${ALERT_LOG} ${ALERT_LOG}.${ALERT_SUFFIX}
      echo "##### Previous alert log moved to ${ALERT_LOG}.${ALERT_SUFFIX}"
>> ${ALERT_LOG}
   fi

   if [[ $LN_CNT_2 -ge 1 ]]; then

      mv ${LISTENER_LOG} ${LISTENER_LOG}.${ALERT_SUFFIX}
      echo "##### Previous listener log moved to
${LISTENER_LOG}.${ALERT_SUFFIX}" >> ${LISTENER_LOG}    fi

  fi
fi

##

trap 'rm /tmp/temp$$' 0 2 3 15

#
# end-of-script
#

Add mailx for those files ${ALERT_LOG}.${ALERT_SUFFIX} , ${LISTENER_LOG}.${ALERT_SUFFIX} in the script and here you go.

Hope that helps somehow.

Trifon Anguelov
Senior Oracle DBA

Check the latest Oracle DBA forums for more info on: http://www.dbaclick.com/cgi-bin/ib3/ikonboard.cgi


"Titi" <thierry.constant2_at_wanadoo.fr> wrote in message news:3c852d45$0$2407$626a54ce_at_news.free.fr...

> Hi,
>
> do you know a way to see the alert file ( or at least the ORA-xxxx)
without
> to log to
> the system and open the file ????
>
> Thanks
>
> oracle 8i on WNT, UNIX
>
>
>
>
Received on Wed Mar 06 2002 - 21:03:28 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US