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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Looking for simple monitor script dbup.bat

RE: Looking for simple monitor script dbup.bat

From: Husak, Orysia - Perot <OHusak_at_chw.edu>
Date: Thu, 06 Feb 2003 09:14:09 -0800
Message-ID: <F001.00546055.20030206091409@fatcity.com>


Bob,
I have a very simple script which checks to see if the database is up and open. I've emailed you the script.

Orysia Husak
Database Management Services
PEROTSYSTEMS
(602) 307-2896
cell: (602) 300-9752

-----Original Message-----
Sent: Thursday, February 06, 2003 9: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_at_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_at_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).

--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: Husak, Orysia - Perot
  INET: OHusak_at_chw.edu

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_at_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). Received on Thu Feb 06 2003 - 11:14:09 CST

Original text of this message

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