Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Oracle on NT
Hi,
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
D:\oracle\ADMIN\>service_find
Service [oracleservicebdb5] is not present
The OracleServiceBDB5 service is starting.............
The OracleServiceBDB5 service was started successfully.
Service [oracleservicebdb5] is running
D:\oracle\ADMIN\>
--start here---
@echo off
set reqd_service=oracleservicebdb5
call :check_service %reqd_service%
net start %reqd_service%
call :check_service %reqd_service%
goto :EOF
:check_service
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
:find_aserv_problem
echo Error in the find command doing service find for %1
echo.
echo Check for service %1 manually
goto :EOF
:serv_notpresent
echo Service [%1] is not present
goto :EOF
--end here---
Hope this helps.
Regards,
Bruce
-----Original Message-----
From: Holman, Rodney [mailto:rodney.holman_at_lodgenet.com]
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
exit
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 [SMTP:paled_at_home.com]
> Sent: Wednesday, October 25, 2000 3:10 AM
> Subject: Re: Oracle on NT
>
> nstetson_at_csc.com 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
![]() |
![]() |