views:

55

answers:

2

Hi

I want to view the ORA errors in alertlogfile of past 7 (monday-sunday)days, by writting in shell scripts. Can anybody help me.

Thanks

+2  A: 

Something like:

sed -n -e '/start_time/,/end_time/ {/ORA/ p}' logfile

or with awk

$ start="Fri Feb 27 08:00:00 2009"
$ end="Fri Mar 6 08:00:00 2009"

$ awk -v prev="$start" -v last="$end" '$0 ~ prev,$0 ~ last' logfile

A more sophisticated script looking for last date entries in ORA file is available here, but also at dba-oracle.com

This does not answer exactly your request but might give you some clues to start your own script.

VonC
Thanks It's working.Am trying to display the date along with ORA errors.
Great. Feel free to complete your question with your current progress and what is missing
VonC
A: 

I want the scripts which give output as follows (one week errors) and it should be mail to my id.

Sat Mar 14 10:30:51 IST 2009

ORA-01157: cannot identify/lock data file 2 - see DBWR trace file

Sat Mar 12 12:35:06 IST 2009

ORA-01110: data file 2: '/u02/oradata/Globe/undotbs01.dbf'

Sat Mar 10 09:54:05 IST 2009 ORA-27037: unable to obtain file status

Sat Mar 08 :15:02 IST 2009

ORA-1157 signalled during: ALTER DATABASE OPEN...

Sat Mar 07 12:35:51 IST 2009

ORA-01157: cannot identify/lock data file 2 - see DBWR trace file