Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Whenever SQLERROR - does it work?

Re: Whenever SQLERROR - does it work?

From: Chris Weiss <chris_at_www.hpdbe.com>
Date: Mon, 21 Jan 2002 11:51:33 -0500
Message-ID: <a2hg2m$epq$1@msunews.cl.msu.edu>


You have a couple of choices in this instance:

  1. Rewrite your shell scripts in Perl which can provide much more control and response to errors than shell.
  2. Use a driver shell script which calls other scripts and either seds, greps, or gawks the output files for errors.

A single self-contained ksh script won't give you what you're looking for.



Chris Weiss
www.hpdbe.com
High Performance Database Engineering

"Kirt Thomas" <kremovethisspamthingthomas_at_gfsiinc.com> wrote in message news:p7do4u4h9emg16cjh8t1jsbsleo2ul567a_at_4ax.com...
> I have a shell script that checks for a given process, and if it's
> running does some stuff - here's a bare outline
>
> #!/bin/ksh
>
> sqlvalue="`sqlplus -s<<EOF
> sys/$SYS_PASS
> set heading off
> set feedback off
> set verify off
> set echo off
> select count(sid)
> from v\\$session vs
> where vs.program like 'OEOSCO';
> exit
> EOF`"
> echo "Sqlvalue=$sqlvalue"
>
> This all works just fine, and I get a count of the number of
> processes, and can do more stuff based on this (it ends up paging
> someone). The problem I have is that during our weekly db
> maintenance, this script (which is crontab'd to run every 10 minutes)
> returns tons of verbiage to the sqlvalue because the db is down.
>
> So I figured I'd just add a line
>
> whenever sqlerror exit 0;
>
> to force an exit with a value of zero on any sqlerror. Since it would
> not be good for my continuted employment to test this by bringing the
> db down, I just dropped the 'n' from v$session - to force an sql
> error. Instead of echoing '0' as expected I get the following ....
>
> Sqlvalue=from v$sessio vs
> *
> ERROR at line 2:
> ORA-00942: table or view does not exist
>
> Soooo, what gives? That is definately an sql error. Am I doing
> something wrong, or does whenever sqlerror not really work as I think
> it should. Thanks.
Received on Mon Jan 21 2002 - 10:51:33 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US