Re: looking at alert log

From: Neil Chandler <neil_chandler_at_hotmail.com>
Date: Fri, 18 Nov 2016 23:37:30 +0000
Message-ID: <AM4PR10MB0145FB5D78C79AEFF76292DA85B00_at_AM4PR10MB0145.EURPRD10.PROD.OUTLOOK.COM>



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_at_freelists.org <oracle-l-bounce_at_freelists.org> on behalf of Justin Mungal <justin_at_n0de.ws> Sent: 18 November 2016 22:41
To: dmarc-noreply_at_freelists.org
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_at_freelists.org<mailto:dmarc-noreply_at_freelists.org>> 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?

--
http://www.freelists.org/webpage/oracle-l




--
http://www.freelists.org/webpage/oracle-l
Received on Sat Nov 19 2016 - 00:37:30 CET

Original text of this message