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: shell script to parse alert log looking for certain ora- errors

Re: shell script to parse alert log looking for certain ora- errors

From: George Dau <gedau_at_isa.mim.com.au>
Date: Tue, 08 Dec 1998 22:29:42 GMT
Message-ID: <366fa3f2.155132378@isappp>


"Pat Soehl" <pat.soehl_at_cxo.dec.com> wrote:

]I'm pretty new to writing shell scripts, being mostly familiar with VMS.
]I'm now a DBA on a Sun Solaris system.   I need a script that
]parses through the alert logs looking for certain ora errors: such as
]600... etc.
]
]Is there some samples somewhere that I could use?

My mail reader (Microsoft Exchange) understands HTML, so I have written a parser which highlights the errors using HTML. This is an adaption of my script and is completely untested - you'll need to change it to do exactly what you want.

You will need to create the e-mail file, append the alert log, then parse it...

#!/bin/sh
LOG=/tmp/AlertParser.$$
TMP=/tmp/tmp.$$
ADMIN=your_at_email.address
echo "Subject: `uname -a` $ORACLE_SID Alet log `date`">$LOG echo " ">>$LOG
cat YOUR_ALERT_LOG_FILE >>$LOG
sed -f logmarker.sed $LOG>$TMP
rmail $ADMIN <$TMP
rm $LOG $TMP >/dev/null 2>&1



and my logmarker.sed contains the following (it is more geared towards looking for problems in backup logs, you can change it to look for Oracle errors).

1 a\
Content-type: text/html
1 a\
<pre>
$ a\
</pre>
/No such file/s/^/<font color="#ff0000"><b>/
/No such file/s/$/<\/b><\/font>/
/cannot start online backup/s/^/<font color="#ff0000"><b>/
/cannot start online backup/s/$/<\/b><\/font>/
/cannot end online backup/s/^/<font color="#ff0000"><b>/
/cannot end online backup/s/$/<\/b><\/font>/
/no tape loaded/s/^/<font color="#ff0000"><b>/
/no tape loaded/s/$/<\/b><\/font>/
/not connected/s/^/<font color="#ff0000"><b>/
/not connected/s/$/<\/b><\/font>/
/not found/s/^/<font color="#ff0000"><b>/
/not found/s/$/<\/b><\/font>/
/Device busy/s/^/<font color="#ff0000"><b>/
/Devicy busy/s/$/<\/b><\/font>/
/dump is aborted/s/^/<font color="#ff0000"><b>/
/dump is aborted/s/$/<\/b><\/font>/
/invalid username/s/^/<font color="#ff0000"><b>/
/invalid username/s/$/<\/b><\/font>/
/terminated unsuccessfully/s/^/<font color="#ff0000"><b>/
/terminated unsuccessfully/s/$/<\/b><\/font>/
/directory at inode/s/^/<font color="#ff00ff"><b>/
/directory at inode/s/$/<\/b><\/font>/


--

 ,-,_|\   George Dau,                                             __

/ * \ Unix (Solaris, DEC Unix, Linux), Oracle, Internet. (OO)
\_,--\_/ Home: gedau_at_pobox.com Work: gedau_at_isa.mim.com.au ( \/ ) v WWW: http://pobox.com/~gedau W--W

MIM Internet policy item 3.4 compliance - "I am clearly stating that any views or opinions expressed above do * NOT * necessarily represent the views or opinions of MIM." Received on Tue Dec 08 1998 - 16:29:42 CST

Original text of this message

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