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

Home -> Community -> Usenet -> c.d.o.server -> Re: How to check whether the Oracle database is up?

Re: How to check whether the Oracle database is up?

From: Rauf Sarwar <rs_arwar_at_hotmail.com>
Date: 31 Aug 2002 08:54:54 -0700
Message-ID: <92eeeff0.0208310754.6706878e@posting.google.com>


srivenu_at_hotmail.com (srivenu) wrote in message news:<1a68177.0208310006.432681e4_at_posting.google.com>...
> If you are on a Unix machine (Say Solaris), the lk{ORACLE_SID.ora}.ora
> file is opened (locked) by the background processes, pmon, smon ,lgwr,
> dbwr, ckpt, reco on instance startup.
> In fact Oracle will use this file to see if an instance you are trying
> to start has already been started.
> So for example: if your ORACLE_SID=test
> Then use fuser $ORACLE_HOME/dbs/lk{ORACLE_SID}.ora to see if the file
> is being used by any processes.
> If it is, then the instance is up.
> But the problem is under rare circumstances, the file may be left
> locked by improper shutdown and hanged processes.
> regards
> Srivenu

IMO, sqlplus test is probably the surest way to find out if instance is up or not,

$ ORACLE_SID=sid export ORACLE_SID
$ echo exit | sqlplus xxx/xxx | grep -i "connected to:" >nul
$ echo $?  

# If $? is 0 then it is up else it is not

OR

C:\> echo exit | sqlplus xxx/xxx_at_xxx | find /i "connected to:" >nul C:\> echo %errorlevel%
rem if %errorlevel% is 0 then it is up else it is not

//Rauf Sarwar Received on Sat Aug 31 2002 - 10:54:54 CDT

Original text of this message

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