General
cancel
Showing results for 
Search instead for 
Did you mean: 

how to retrieve ORA error from alert log for specific date?

how to retrieve ORA err
Occasional Visitor

how to retrieve ORA error from alert log for specific date?

Hi,

i am using following command to retrieve ORA ERRORS,

$grep ORA- alert.log|more

it displays all errors..

But i want what errors have been updated sepecific date?

Thanks,
5 REPLIES
Hein van den Heuvel
Honored Contributor

Re: how to retrieve ORA error from alert log for specific date?

Well, you could pre-filter the file with say awk:

$ awk '/Wed Jul 02/,/xxxx/' alert_xe.log | grep ORA

(xxxx is just a string NOT occuring in the file after teh target date.


But in htat case, why not let awk (or perl) do the whole job:

$ awk '/Wed Jul 02/ {x++} /ORA/ && x' alert_xe.log

If I was serious (paid money) about this then I would

1) roll my alert logs evey week or month.

2) use perl and timelocal to convert the date to a time in seconds, and compare for GT instead of equal, hoping the date is in the file.

Cheers,

Hein.
how to retrieve ORA err
Occasional Visitor

Re: how to retrieve ORA error from alert log for specific date?

Hi,

i couldn't understand 'xxxxx'. please help to me
Steven E. Protter
Exalted Contributor

Re: how to retrieve ORA error from alert log for specific date?

Shalom,

It depends on the date format.

Lets say the file says

Dec 15 2008 - oracle blah blah blah

try

grep "Dec 15 2008" alert.log

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
how to retrieve ORA err
Occasional Visitor

Re: how to retrieve ORA error from alert log for specific date?

Hi,

My alert log file contain like this format

Wed Sep 17 16:48:11 2008

Thanks,
Hein van den Heuvel
Honored Contributor

Re: how to retrieve ORA error from alert log for specific date?

SEP, Oracle alert logs look like

date
"information blob"

The information blob starts with ^ORA- for errors, which are looked for./


Dear "how to retrieve ORA error from alert log file fo",

You asked: "i couldn't understand 'xxxxx'. please help to me"

Please re-read my reply. It was explained in there.

Anyway,

In AWK (and other tools) the construct '/Wed Jul 02/,/xxxx/' is a 'range pattern'.
AWK strart by looking for the begin pattern (here a date) and the range is turned ON when that is seen. With the range ON, all input records are selected and each record is matched against the end-pattern (here xxxx). If the end pattern is not found, then the ranges stays ON. The xxxx, or any other improbale string will never be matched.

Admittedly the construct is better written as: '/Wed Jul 02/,0'
That is... ON when "Wed Jul 02" is seen, OFF = whenever 0 become true, which should be 'never'

Cheers,
Hein.