|
|
|
Re: Checking Oracle Instance [message #307779 is a reply to message #306406] |
Wed, 19 March 2008 19:05 |
|
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
|
|
|