This content has been marked as final. Show 1 reply
This may satisfy your needs for Windows. You will have to modify the settings for your environment. Obviously, this is not an exhaustive test, but the process should provide a cursory status of your database.
@echo off setlocal set oracle_home=E:\oracle\product\10.2 set path=E:\oracle\product\10.2\bin set oracle_sid=orcl10 ( 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 oracleserviceorcl10 ^| %SystemRoot%\system32\find "STATE"') do echo %%i endlocal