Re: email oracle errors

From: Alan Connor (zzzzzz_at_xxx.yyy)
Date: 06/29/04


Date: Tue, 29 Jun 2004 07:46:08 GMT

On Mon, 28 Jun 2004 16:43:57 -0400, Dale DeRemer <dderemer_nospam@agmc.org> wrote:
>
>
> I'm running an Oracle tool every night, dbv, and I put the results in a log
> file. What I'd like to do is have the results emailed to the dba group, only
> if there is an error. The log file looks like this:
>
> DBVERIFY: Release 8.1.7.0.0 - Production on Mon Jun 28 01:50:03 2004
>
> (c) Copyright 2000 Oracle Corporation. All rights reserved.
>
> DBVERIFY - Verification starting : FILE = /d05/oradata/isa/system01.dbf
> ............................................................................
> .
>
> DBVERIFY - Verification complete
>
> Total Pages Examined : 38400
> Total Pages Processed (Data) : 5178
> Total Pages Failing (Data) : 0
> Total Pages Processed (Index) : 2970
> Total Pages Failing (Index) : 0
> Total Pages Processed (Other) : 510
> Total Pages Empty : 29742
> Total Pages Marked Corrupt : 0
> Total Pages Influx : 0
>
> If there is a non zero value for either of the lines "Failing", I'd like to
> generate an email.
> Thanks in advance.
>
>

Hi Dale.

Assuming that's a discrete file that is generated each time dbv is run,
you could use a wrapper script something like this:

#!/bin/sh

dbv <args> &&

if grep 'Failing.*(Index).*[1-9]\|Failing.*(Data).*[1-9]' logfile &> /dev/null
then mail <address> -s "dbv logfile : ERROR" < logfile
else exit 0
fi

If the above is appended to a file after each run, we'll have to
extract the latest entry first, or something like that.

Probably have dbv send a copy of the entry to a file to be rm'd after
the mail is sent off. As in dbv <args> | tee tempfile, perhaps.

AC