Oracle FAQ Your Portal to the Oracle Knowledge Grid

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Oracle on NT

RE: Oracle on NT

From: Reardon, Bruce (CALBBAY) <>
Date: Wed, 25 Oct 2000 23:17:17 -0000
Message-Id: <>


To work out if a service is running under NT you could use the batch file copied into this mail.

This example will show you if the set service is running and then start it and show the different output.

It relies on find setting an errorlevel depending upon whether it locates the given string.

One could do a similar thing to check the output of connecting to the database.

The OEM event for database up/down doesn't (in my experience) check that you can connect to the database - eg if you get an ora-600 and the database hangs the db up/down event does not get triggered (though in this case one checking the alert log will get triggered).

Example use is
Service [oracleservicebdb5] is not present The OracleServiceBDB5 service is starting............. The OracleServiceBDB5 service was started successfully.

Service [oracleservicebdb5] is running


--start here---
@echo off

set reqd_service=oracleservicebdb5

call :check_service %reqd_service%

net start %reqd_service%

call :check_service %reqd_service%

goto :EOF


   net start | find "%1" /i > nul

   if errorlevel==2 goto find_aserv_problem    if errorlevel==1 goto serv_notpresent

   echo Service [%1] is running

   goto :EOF


   echo Error in the find command doing service find for %1    echo.
   echo Check for service %1 manually
   goto :EOF


   echo Service [%1] is not present
   goto :EOF
--end here---

Hope this helps.

-----Original Message-----
From: Holman, Rodney [] Sent: Wednesday, 25 October 2000 23:56
Subject: RE: Oracle on NT

To see if the database is running you are going to have to write a sqlplus script and spool the output. All you need is to do something like

sqlplus user/pword @dbtest.sql

REM dbtest.sql
spool dbup.txt
select user from dual;
spool off

If the db is down you will have an error note in dbup.txt. Otherwise, it will just show your username

The reason for this is that Oracle on NT is a multithread single service. If you look in taskmanager all you will see is one ORACLE.EXE running. This process contains all the threads for SMON, PMON, ARCH, DBWR, LGWR, CKPT, etc. WinNT resource kit has a tool (obviously not for free, it's Microslop) to actually look at the threads within a process. The services in NT can still be shown as running without the DB being up so don't trust the service being up to equal db available. Another way to handle DB up/down notification stuff is to install OEM and use the events to track and report on this.

Rodd Holman

> -----Original Message-----
> From: Paul Drake []
> Sent: Wednesday, October 25, 2000 3:10 AM
> Subject: Re: Oracle on NT
> wrote:
> >
> > Does anyone have any scripts on NT to determine if the Oracle service is
> > running?
> >
> > I am also interested in a script to determine if the database itself is
> > up/down when the service is running.
> >
> > Thanks,
> > Nancy
> Nancy,
> This is very crude - in fact, so much so that I am doubting whether to
> post it at all.
> So far, you've received no reply, so I guess that this is better than
> nothing.
> This was on W2K Pro:
> C:\>(net start) > net_start.txt
> C:\>find "Ora*" net_start.txt
> ---------- NET_START.TXT
> Backup Exec Oracle Agent
> OracleOraHome81TNSListener
> OracleServiceDEV
> OracleServiceRCV
> OracleWebAssistant0
> Its mighty crude, but its headed in the right direction.
Received on Wed Oct 25 2000 - 18:17:17 CDT

Original text of this message