Re: looking at alert log

  • From: Neil Chandler <neil_chandler@xxxxxxxxxxx>
  • To: oracle-l-freelists <oracle-l@xxxxxxxxxxxxx>
  • Date: Fri, 18 Nov 2016 23:37:30 +0000

Brian,


Can I suggest you use the "adrci" utility to do this. It installed by default, 
is very simple to use, and I would recommend it for checking your alert log 
anyway (interactively you can do "adrci" then "show alert" and pick the alert 
log to view from a numbered list)


You can put queries into the command line version to strip down to the bits you 
want, like "originating_timestamp>=systimestamp-(30/1440)" for the last 30 
minutes.

e.g.

adrci exec="set home ${adrci_home} ; show alert -p \\\"(message_text like 
'%ORA-%' and originating_timestamp>=systimestamp-(1/48) \\\"" -term

I wrote a blog post about how you do this, with a very short shell script that 
will automatically check every Oracle DB under an ORACLE_HOME (so if you have 
grid and oracle users, you should run 2 of these - one per home) - cron the 
code to run and you're away. IF you add another Oracle database to the Oracle 
Home, it gets picked up automatically by the script.


https://chandlerdba.wordpress.com/2015/01/06/checking-the-alert-log-the-easy-way/


I put a version of the script in my blog onto *every* client site I attend (if 
they let me, but they always let me). It's a nice catch-all to complement any 
other monitoring, and its short enough to type-in in a few minutes.


regards


Neil Chandler




________________________________
From: oracle-l-bounce@xxxxxxxxxxxxx <oracle-l-bounce@xxxxxxxxxxxxx> on behalf 
of Justin Mungal <justin@xxxxxxx>
Sent: 18 November 2016 22:41
To: dmarc-noreply@xxxxxxxxxxxxx
Cc: oracle-l-freelists
Subject: Re: looking at alert log

Won't tail -f just continually "follow" the alert log, and thus not pass 
anything on to grep?

On Fri, Nov 18, 2016 at 4:34 PM, Yong Huang 
<dmarc-noreply@xxxxxxxxxxxxx<mailto:dmarc-noreply@xxxxxxxxxxxxx>> wrote:
Brian,

Instead of reading the entire alert.log, which could grow big, why not read the 
tail?

tail -f alert.log | grep pattern

I have a fairly sophiscated example (called ck_alert_log.sh) at 
http://yong321.freeshell.org/computer/logfile.html

The `tail -f' command uses near-zero CPU and I/O, regardless the size of 
alert.log, and can immediately notify you of an error (if the command is piped 
to mail),

If you must do this with SQL, x$dbgalertext is the table you need to query as 
others have suggested. Or v$diag_alert_ext, which is the ADR version, and is 
slower. Alternatively, create an external table based on alert.log. But you 
can't read from the tail of the file.

Yong

Zelli, Brian wrote:

I am running this script to check the alert log for errors and it runs every 
few minutes.
How can I just look at the last few minutes as opposed to the entire day?
--
//www.freelists.org/webpage/oracle-l



Other related posts: