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-----
From: Bob Metelsky [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 06, 2003 11:00 AM
To: Multiple recipients of list ORACLE-L
Subject: Looking for simple monitor script dbup.bat
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: [EMAIL PROTECTED]
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: [EMAIL PROTECTED] (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).
