oracledba.help
Scripts

oractl.bat

<- Scripts

@echo off
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Purpose:       Start|Stop Oracle Windows Services
:: Oracle:        11g or later.
:: Windows:       Tested on Windows 2008
::
:: Usage:         Change user variables as required to match your environment.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Revision History
:: -----------------------------------------------------------------------------------
:: Author        |Date       | Comments
:: -----------------------------------------------------------------------------------
:: M. Elliott    |2014.06a | Initial version.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::
:: User Vars
::::::::::::::::::::
set sDBSvc=OracleServiceDB1&
set sLstnrSvc=OracleOraDb12g_home1TNSListener&

rem Help
if "%1"=="" (
   echo Usage: oractl.bat ^[^1^|^0^|^B^]
   echo.
   pause   
   GOTO END
)   

::::::::::::::::::::
:: Process
::::::::::::::::::::

rem Bounce
if "%1" == "B" (
   rem Stop
   net stop %sLstnrSvc%   

   net stop %sDBSvc%
   ping 127.0.0.1 -n 5 -w 1000 > NUL 2>&1

   rem Start
   net start %sDBSvc%
   net start %sLstnrSvc%
   echo.
   echo Database Services bounced
   echo.
   ping 127.0.0.1 -n 5 -w 1000 > NUL 2>&1
   GOTO END
)

rem Start
if "%1" == "1" (
   net start %sDBSvc%
   net start %sLstnrSvc%
   echo.
   echo Database Services Started
   echo.
   ping 127.0.0.1 -n 5 -w 1000 > NUL 2>&1
   GOTO END
)

rem Stop
if "%1" == "0" (
   net stop %sLstnrSvc%
   net stop %sDBSvc%
   echo.
   echo Database Services Stopped
   echo.
   ping 127.0.0.1 -n 5 -w 1000 > NUL 2>&1
   GOTO END
)

::::::::::::::::::::
:: End
::::::::::::::::::::
:END
exit /b