From: plovmand@hotmail.com (Kenneth Koenraadt)
Newsgroups: comp.databases.oracle.misc
Subject: Re: SQL command to determine if DB is open
Message-ID: <3b719560.6485512@news.mobilixnet.dk>
References: <6b0f7239.0108070910.40766f3f@posting.google.com> <SoVb7.27727$jA2.1939219@news20.bellglobal.com> <6b0f7239.0108080617.5e6e3a52@posting.google.com>
X-Newsreader: Forte Free Agent 1.11/32.235
Lines: 35
Date: Wed, 08 Aug 2001 19:42:17 GMT
NNTP-Posting-Host: 212.97.246.137
X-Complaints-To: abuse@orangedk.com
X-Trace: news.mobilixnet.dk 997299943 212.97.246.137 (Wed, 08 Aug 2001 21:45:43 CEST)
NNTP-Posting-Date: Wed, 08 Aug 2001 21:45:43 CEST
Organization: Mobilix Internet -- http://www.orangedk.com/


On 8 Aug 2001 07:17:11 -0700, amw157@aol.com (Andy Weiss) wrote:

Hi Andy,

As simple as it can get :
This Sql*PLUS script returns 1 when datase is open, 0 when not and
*nothing* else.

*********'
set heading off;
SELECT case when status = 'OPEN' then 1 else 0 end as result
FROM V$INSTANCE;
************




>> If I understand you correctly, how about using something like the v$instance
>> view (described next)
>
>I guess I should  have been more specific.  I need to do this from
>within a batch file.  In other words, if the database is open, do
>these steps; if the database is not open, do these other steps.
>
>I don't think v$instance will do the trick for me.  I need a statement
>that returns to me a boolean or an integer that tells whether the
>result of the statement was true or false.
>
>Andy

Regards,
Kenneth Koenraadt
Systems Consultant
Oracle DBA
plovmand@<no-spam>hotmail.com

