Java Mailing List Archive

http://www.dba.5341.com/

Home » Home (12/2007) » oracle l »

RE: writing job dependencies shell script

Koivu, Lisa

2004-02-18


Hi Elain,=20

Check this out, I've used it successfully in the past
http://www.adpc.purdue.edu/DataMgmt/DBA/Stds/sqlscripts.htm

Lisa Koivu
Oracle Monkey
Orlando, FL, USA

-----Original Message-----
From: elain he [mailto:elainhe@(protected)
Sent: Wednesday, February 18, 2004 10:51 PM
To: oracle-l@(protected)
Subject: writing job dependencies shell script

Hi,
I'm trying to figure out how I can write a shell script that checks the=20
success or failure of DML statements. I have a number of jobs that are

dependent on one another. For eg. if JobA fails do not process jobB, and

likewise if jobB fails, do not process jobC.

Each job looks like the following:
jobA:
=3D=3D=3D
#!/bin/ksh
sqlplus << eof
username/password
update tableA set .....
eof

jobB:
=3D=3D=3D=3D
#!/bin/ksh
sqlplus << eof
username/password
delete tableB .....
eof

I'm trying to write a simple shell script that does the following checks

before executing each job:
#!/bin/ksh
jobA
if [ $? =3D 0 ];then
  jobB
  if [ $? =3D 0];then
      jobC
      if [ $? =3D 0];then
         jobD
      else
         exit
      fi
  else
      exit
  fi
else
  exit
fi

The problem I'm encountering is $? always returns 0 because the sqlplus=20
always completes successfully even though my update or delete statement=20
fails due to rollback seg space or any other issues.

Can someone provide me some pointers on how I can write an error
handling=20
routine? If there is a better way of writing this, please let me know.

thanks.

elain

_________________________________________________________________
Watch high-quality video with fast playback at MSN Video. Free!=20
http://click.atdmt.com/AVE/go/onm00200365ave/direct/01/

----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to: oracle-l-request@(protected)
put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

"The sender believes that this E-Mail and any attachments were free of =
any virus, worm, Trojan horse, and/or malicious code when sent. This =
message and its attachments could have been infected during =
transmission. By reading the message and opening any attachments, the =
recipient accepts full responsibility for taking proactive and remedial =
action about viruses and other defects. The sender's business entity is =
not liable for any loss or damage arising in any way from this message =
or its attachments."

----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to: oracle-l-request@(protected)
put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------


©2008 dba.5341.com - Jax Systems, LLC, U.S.A.