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

Home -> Community -> Usenet -> c.d.o.tools -> Re: SQL command to determine if DB is open

Re: SQL command to determine if DB is open

From: John Strange <jstrange_at_imtn.dsccc.com>
Date: 8 Aug 2001 11:57:20 -0500
Message-ID: <3b716f70$1@news.alcatel.com>

/*************************************

* ck_instance.sql
**************************************/

WHENEVER SQLERROR EXIT sql.sqlcode;
select global_name from global_name_at_some_instance ; exit 249

/*********** end ck_instance.sql ******/

On *nix box

sqlplus scott/tiger @ck_instance
if [ $? != 249 ] ; then
  mailx -s "Oracle is down" amw157_at_aol.com < /dev/null fi

On Micro$oft :(

set ERRORLEVEL=
sqlplus scott/tiger @ck_instance
if %ERRORLEVEL% == 249 goto passed_sql
  (your dos code here)
:passed_sql

: "Andy Weiss" <amw157_at_aol.com> wrote in message
: news:6b0f7239.0108070910.40766f3f_at_posting.google.com...
: > I need a quick command that I can execute in SQL Plus to determine if
: > a database is open or not. Been wading through Oracle's documentation
: > hopelessly for hours.

--
While Alcatel may claim ownership of all my ideas (on or off the job),
Alcatel does not claim any responsibility for them. Warranty expired when u
opened this article and I will not be responsible for its contents or use.
Received on Wed Aug 08 2001 - 11:57:20 CDT

Original text of this message

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