Return-Path: <root@fatcity.cts.com>
Received: from ensim.rackshack.net (root@localhost)
 by orafaq.net (8.11.6/8.11.6) with ESMTP id h16LlFZ16229
 for <oracle-l@orafaq.net>; Thu, 6 Feb 2003 15:47:15 -0600
X-ClientAddr: 209.68.248.164
Received: from newsfeed.cts.com (newsfeed.cts.com [209.68.248.164])
 by ensim.rackshack.net (8.11.6/8.11.6) with ESMTP id h16LlEQ16222
 for <oracle-l@orafaq.net>; Thu, 6 Feb 2003 15:47:14 -0600
Received: from fatcity.UUCP (uucp@localhost)
 by newsfeed.cts.com (8.9.3/8.9.3) with UUCP id KAA32158;
 Thu, 6 Feb 2003 10:30:22 -0800 (PST)
Received: by fatcity.com (26-Feb-2001/v1.0g-b72/bab) via UUCP id 00546158; Thu, 06 Feb 2003 09:39:54 -0800
Message-ID: <F001.00546158.20030206093954@fatcity.com>
Date: Thu, 06 Feb 2003 09:39:54 -0800
To: Multiple recipients of list ORACLE-L <ORACLE-L@fatcity.com>
X-Comment: Oracle RDBMS Community Forum
X-Sender: "Koivu, Lisa" <Lisa.Koivu@efairfield.com>
Sender: root@fatcity.com
Reply-To: ORACLE-L@fatcity.com
Errors-To: ML-ERRORS@fatcity.com
From: "Koivu, Lisa" <Lisa.Koivu@efairfield.com>
Subject: RE: Looking for simple monitor script dbup.bat
Organization: Fat City Network Services, San Diego, California
X-ListServer: v1.0g, build 72; ListGuru (c) 1996-2001 Bruce A. Bergman
Precedence: bulk
Mime-Version: 1.0
Content-Type: multipart/alternative;	boundary="----_=_NextPart_001_01C2CE05.FE83BD00"
------_=_NextPart_001_01C2CE05.FE83BD00
Content-Type: text/plain;
 charset="iso-8859-1"

Hi Bob, 

Check out Steve Adams' script (www.ixora.com.au).  It's written in ksh and
will need a little modification to send emails, but it's bulletproof.  Also
others on the list have mentioned Cygwin (?) the Windows-ksh to allow this
to run on your hosts.

Lisa Koivu
Oracle Dingbat Administrator
Fairfield Resorts, Inc.
5259 Coconut Creek Parkway
Ft. Lauderdale, FL, USA  33063
Office: 954-935-4117  
Fax:    954-935-3639
Cell:    954-683-4459


-----Original Message-----
Sent: Thursday, February 06, 2003 11:00 AM
To: Multiple recipients of list ORACLE-L


Good morning everyone Win2k pro, oracle 8.17

Ive been investigating a simple monitor script which will email me if
the database is not available. I need this to be as simple as possible
(ideally a batch file)

Ive come across this on orafaq
http://www.orafaq.net/scripts/win/isdbup.txt

But dosnt seem to work. If you pass an incorrect sid, or file parameters
the script just hangs

I have a modified version 
##############################################
Rem dbup.bat
@echo off
set ORACLE_SID=locdb
sqlplus internal/pw@%ORACLE_SID% @C:\conn.sql 

if {%ERRORLEVEL%} == {0} (
   echo Database %ORACLE_SID% is available
) else (
   echo Database %ORACLE_SID% is NOT available
)
##############################################

[conn.sql]
set echo off feed off pages 0  
-- whenever sqlerror exit sql.sqlcode
WHENEVER SQLERROR EXIT 1
select * from global_name;       
exit ;
##############################################

Although this works (gets into the error level) AFTER you hit enter to
walk throough the errors
The script gets stuck on Errors Such as 
If the db is down
ERROR:
ORA-01034: ORACLE not available
Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied

Or if I pass and invalid sid, (I can live with only passing valid sids)
but how can I get sql+ to exit out of the error if in fact the db is not
up
I think Ive tried all variations of SQLERROR 

http://lina.cli.di.unipi.it:8000/WG73-doc/sqlplus/sp33/ch646.html

Any ideas for the gurus??? 

Many thanks
bob
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Bob Metelsky
  INET: bmetelsky@cps92.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru@fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

------_=_NextPart_001_01C2CE05.FE83BD00
Content-Type: text/html;
 charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2653.12">
<TITLE>RE: Looking for simple monitor script dbup.bat</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>Hi Bob, </FONT>
</P>

<P><FONT SIZE=3D2>Check out Steve Adams' script =
(www.ixora.com.au).&nbsp; It's written in ksh and will need a little =
modification to send emails, but it's bulletproof.&nbsp; Also others on =
the list have mentioned Cygwin (?) the Windows-ksh to allow this to run =
on your hosts.</FONT></P>

<P><FONT SIZE=3D2>Lisa Koivu</FONT>
<BR><FONT SIZE=3D2>Oracle Dingbat Administrator</FONT>
<BR><FONT SIZE=3D2>Fairfield Resorts, Inc.</FONT>
<BR><FONT SIZE=3D2>5259 Coconut Creek Parkway</FONT>
<BR><FONT SIZE=3D2>Ft. Lauderdale, FL, USA&nbsp; 33063</FONT>
<BR><FONT SIZE=3D2>Office: 954-935-4117&nbsp; </FONT>
<BR><FONT SIZE=3D2>Fax:&nbsp;&nbsp;&nbsp; 954-935-3639</FONT>
<BR><FONT SIZE=3D2>Cell:&nbsp;&nbsp;&nbsp; 954-683-4459</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: Bob Metelsky [<A =
HREF=3D"mailto:bmetelsky@cps92.com">mailto:bmetelsky@cps92.com</A>]</FON=
T>
<BR><FONT SIZE=3D2>Sent: Thursday, February 06, 2003 11:00 AM</FONT>
<BR><FONT SIZE=3D2>To: Multiple recipients of list ORACLE-L</FONT>
<BR><FONT SIZE=3D2>Subject: Looking for simple monitor script =
dbup.bat</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>Good morning everyone Win2k pro, oracle 8.17</FONT>
</P>

<P><FONT SIZE=3D2>Ive been investigating a simple monitor script which =
will email me if</FONT>
<BR><FONT SIZE=3D2>the database is not available. I need this to be as =
simple as possible</FONT>
<BR><FONT SIZE=3D2>(ideally a batch file)</FONT>
</P>

<P><FONT SIZE=3D2>Ive come across this on orafaq</FONT>
<BR><FONT SIZE=3D2><A =
HREF=3D"http://www.orafaq.net/scripts/win/isdbup.txt" =
TARGET=3D"_blank">http://www.orafaq.net/scripts/win/isdbup.txt</A></FONT=
>
</P>

<P><FONT SIZE=3D2>But dosnt seem to work. If you pass an incorrect sid, =
or file parameters</FONT>
<BR><FONT SIZE=3D2>the script just hangs</FONT>
</P>

<P><FONT SIZE=3D2>I have a modified version </FONT>
<BR><FONT =
SIZE=3D2>##############################################</FONT>
<BR><FONT SIZE=3D2>Rem dbup.bat</FONT>
<BR><FONT SIZE=3D2>@echo off</FONT>
<BR><FONT SIZE=3D2>set ORACLE_SID=3Dlocdb</FONT>
<BR><FONT SIZE=3D2>sqlplus internal/pw@%ORACLE_SID% @C:\conn.sql =
</FONT>
</P>

<P><FONT SIZE=3D2>if {%ERRORLEVEL%} =3D=3D {0} (</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp; echo Database %ORACLE_SID% is =
available</FONT>
<BR><FONT SIZE=3D2>) else (</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp; echo Database %ORACLE_SID% is NOT =
available</FONT>
<BR><FONT SIZE=3D2>)</FONT>
<BR><FONT =
SIZE=3D2>##############################################</FONT>
</P>

<P><FONT SIZE=3D2>[conn.sql]</FONT>
<BR><FONT SIZE=3D2>set echo off feed off pages 0&nbsp; </FONT>
<BR><FONT SIZE=3D2>-- whenever sqlerror exit sql.sqlcode</FONT>
<BR><FONT SIZE=3D2>WHENEVER SQLERROR EXIT 1</FONT>
<BR><FONT SIZE=3D2>select * from =
global_name;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=3D2>exit ;</FONT>
<BR><FONT =
SIZE=3D2>##############################################</FONT>
</P>

<P><FONT SIZE=3D2>Although this works (gets into the error level) AFTER =
you hit enter to</FONT>
<BR><FONT SIZE=3D2>walk throough the errors</FONT>
<BR><FONT SIZE=3D2>The script gets stuck on Errors Such as </FONT>
<BR><FONT SIZE=3D2>If the db is down</FONT>
<BR><FONT SIZE=3D2>ERROR:</FONT>
<BR><FONT SIZE=3D2>ORA-01034: ORACLE not available</FONT>
<BR><FONT SIZE=3D2>Enter user-name:</FONT>
<BR><FONT SIZE=3D2>ERROR:</FONT>
<BR><FONT SIZE=3D2>ORA-01017: invalid username/password; logon =
denied</FONT>
</P>

<P><FONT SIZE=3D2>Or if I pass and invalid sid, (I can live with only =
passing valid sids)</FONT>
<BR><FONT SIZE=3D2>but how can I get sql+ to exit out of the error if =
in fact the db is not</FONT>
<BR><FONT SIZE=3D2>up</FONT>
<BR><FONT SIZE=3D2>I think Ive tried all variations of SQLERROR </FONT>
</P>

<P><FONT SIZE=3D2><A =
HREF=3D"http://lina.cli.di.unipi.it:8000/WG73-doc/sqlplus/sp33/ch646.htm=
l" =
TARGET=3D"_blank">http://lina.cli.di.unipi.it:8000/WG73-doc/sqlplus/sp33=
/ch646.html</A></FONT>
</P>

<P><FONT SIZE=3D2>Any ideas for the gurus??? </FONT>
</P>

<P><FONT SIZE=3D2>Many thanks</FONT>
<BR><FONT SIZE=3D2>bob</FONT>
<BR><FONT SIZE=3D2>-- </FONT>
<BR><FONT SIZE=3D2>Please see the official ORACLE-L FAQ: <A =
HREF=3D"http://www.orafaq.net" =
TARGET=3D"_blank">http://www.orafaq.net</A></FONT>
<BR><FONT SIZE=3D2>-- </FONT>
<BR><FONT SIZE=3D2>Author: Bob Metelsky</FONT>
<BR><FONT SIZE=3D2>&nbsp; INET: bmetelsky@cps92.com</FONT>
</P>

<P><FONT SIZE=3D2>Fat City Network Services&nbsp;&nbsp;&nbsp; -- =
858-538-5051 <A HREF=3D"http://www.fatcity.com" =
TARGET=3D"_blank">http://www.fatcity.com</A></FONT>
<BR><FONT SIZE=3D2>San Diego, =
California&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Mailing list =
and web hosting services</FONT>
<BR><FONT =
SIZE=3D2>---------------------------------------------------------------=
------</FONT>
<BR><FONT SIZE=3D2>To REMOVE yourself from this mailing list, send an =
E-Mail message</FONT>
<BR><FONT SIZE=3D2>to: ListGuru@fatcity.com (note EXACT spelling of =
'ListGuru') and in</FONT>
<BR><FONT SIZE=3D2>the message BODY, include a line containing: UNSUB =
ORACLE-L</FONT>
<BR><FONT SIZE=3D2>(or the name of mailing list you want to be removed =
from).&nbsp; You may</FONT>
<BR><FONT SIZE=3D2>also send the HELP command for other information =
(like subscribing).</FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01C2CE05.FE83BD00--
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Koivu, Lisa
  INET: Lisa.Koivu@efairfield.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru@fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

