Home » Infrastructure » Windows » Checking Oracle Instance (Windows NT)
Checking Oracle Instance [message #306406] Fri, 14 March 2008 02:00 Go to next message
sidd_411
Messages: 30
Registered: March 2008
Member
Hi,

I want to check whether or not Oracle is running in Windows through command line. How to do that ?
Re: Checking Oracle Instance [message #306421 is a reply to message #306406] Fri, 14 March 2008 02:39 Go to previous messageGo to next message
Michel Cadot
Messages: 68728
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
sqlplus user/psw

Regards
Michel
Re: Checking Oracle Instance [message #307729 is a reply to message #306406] Wed, 19 March 2008 13:30 Go to previous messageGo to next message
Kevin La Barre
Messages: 1
Registered: March 2008
Location: Austin, TX
Junior Member

If you're looking for something similar to what we do for *nix, you can use PSList from the PSTools collection available here to look for "oracle". There also exist several Unix-like utilities for Windows, like "ps". A simple Google search should turn up a few matches. That will tell you if the instance is up... not necessarily that the database is open however. For that I'd follow the sqlplus route.

Goodluck!

Kevin
Re: Checking Oracle Instance [message #307779 is a reply to message #306406] Wed, 19 March 2008 19:05 Go to previous message
ebrian
Messages: 2794
Registered: April 2006
Senior Member
You could put the following code into a batch file to test the status of the instance and the database. Please keep in mind that this isn't an exhaustive test.

@echo off
setlocal
set oracle_home=E:\oracle\10.2.0
set path=E:\oracle\10.2.0\bin
set oracle_sid=ora10g
(
echo conn / as sysdba
echo set head off feed off pages 0
echo select status from v$instance;
) | sqlplus -s /nolog > %TEMP%\status.log

for /f "tokens=3" %%i in ('%SystemRoot%\system32\find /c "OPEN" %TEMP%\status.log') do (
if %%i == 1 (
echo Database is OPEN
) ELSE (
echo Databse does NOT appear to be OPEN
))

for /f "tokens=4" %%i in ('%SystemRoot%\system32\sc query oracleserviceora10g ^| 
	%SystemRoot%\system32\find "STATE"') do echo The Oracle service is %%i
endlocal

[Updated on: Wed, 19 March 2008 19:09]

Report message to a moderator

Previous Topic: Change Password
Next Topic: how to start database automatically?
Goto Forum:
  


Current Time: Sun Dec 22 06:15:07 CST 2024