@echo off
setLocal
SET OMS_OTRACE_CF=true
if "%OMS_MAX_ABNORMAL_EXIT%." == "." set OMS_MAX_ABNORMAL_EXIT=3
if "%OMS_TIME_DELTA%." == "." set OMS_TIME_DELTA=600
set PREV_DATE=0
set NUM_ABORTS=0
REM Make sure that our JRE is used for this invocation.
SET PATH=C:\Program Files\Oracle\jre\1.1.8\bin;C:\oracle\ora92\bin;%PATH%
SET OHOME=C:\oracle\ora92
SET CLASSROOT=C:\oracle\ora92\classes
SET JLIBROOT=C:\oracle\ora92\jlib
SET NETJLIBROOT=C:\oracle\ora92\network\jlib
SET OEMCLASSES=%JLIBROOT%/oembase-9_2_0.jar;%JLIBROOT%/oemtools-9_2_0.jar
SET BALICLASSES=%JLIBROOT%/swingall-1_1_1.jar;%JLIBROOT%/ewtcompat-3_3_15.jar;%JLIBROOT%/ewt3.jar;%JLIBROOT%/ewt3-nls.jar;%JLIBROOT%/share.jar
SET AURORACLASSES=C:\oracle\ora92\lib\aurora_client.jar
SET JDBCCLASSES=C:\oracle\ora92\jdbc\lib\classes111.zip;C:\oracle\ora92\jdbc\lib\nls_charset11.zip
SET ORBCLASSES=C:\oracle\ora92/lib/vbjorb.jar;C:\oracle\ora92/lib/vbjapp.jar
SET SECURITYCLASSES=%JLIBROOT%/javax-ssl-1_1.jar;%JLIBROOT%/jssl-1_1.jar
SET OSDNETCLASSES=%JLIBROOT%/netcfg.jar
SET XMLCLASSES=C:\oracle\ora92\lib\xmlparserv2.jar
SET MISCCLASSES=C:\oracle\ora92/assistants/jlib/assistantsCommon.jar;%JLIBROOT%/jle2.jar;%JLIBROOT%/jle2-nls.jar
SET QSMACLASSES=C:\oracle\ora92\rdbms\jlib\qsma.jar
SET NETMGRCLASSES=%NETJLIBROOT%/netmgrm.jar;%NETJLIBROOT%/netmgr.jar;C:\oracle\ora92/network/tools
SET CLASSPATHADD=%ORBCLASSES%;%BALICLASSES%;%JDBCCLASSES%;%OHOME%;%CLASSROOT%;%NETJLIBROOT%;%OEMCLASSES% ;%SECURITYCLASSES%;%OSDNETCLASSES%;%AURORACLASSES%;%XMLCLASSES%;%MISCCLASSES%;%QSMACLASSES%;%NETMGRC LASSES%
REM hook for classpath additions
if not "%ORACLE_OEM_CLASSPATH%" == "" SET CLASSPATHADD=%ORACLE_OEM_CLASSPATH%;%CLASSPATHADD%
SET JRE=jre -nojit -mx128m
SET CLASSPATH_QUAL=cp
if "%ORACLE_OEM_JAVARUNTIME%x" EQU "x" goto jreSetup
SET JRE=%ORACLE_OEM_JAVARUNTIME%\bin\java -mx128m
SET CLASSPATH_QUAL=classpath
SET CLASSPATHADD=%CLASSPATHADD%;%ORACLE_OEM_JAVARUNTIME%\lib\classes.zip
:jreSetup
SET ME=oemctl
SET USAGE="Usage: %ME% {start|stop|status} oms [Credentials]"
REM # Action requested
if "%1%" == "/?" goto syntax
if "%1%" == "" goto syntax
goto checkaction
:syntax
@echo "Syntax: OEMCTL START OMS "
@echo " OEMCTL STOP OMS
/"
@echo " OEMCTL STATUS OMS /[@]"
@echo " OEMCTL PING OMS "
@echo " OEMCTL START PAGING [BootHost Name] "
@echo " OEMCTL STOP PAGING [BootHost Name] "
@echo " OEMCTL ENABLE EVENTHANDLER"
@echo " OEMCTL DISABLE EVENTHANDLER"
@echo " OEMCTL EXPORT EVENTHANDLER "
@echo " OEMCTL IMPORT EVENTHANDLER "
@echo " OEMCTL DUMP EVENTHANDLER"
@echo " OEMCTL IMPORT REGISTRY /@"
@echo " OEMCTL EXPORT REGISTRY /@"
@echo " OEMCTL CONFIGURE RWS"
goto end
:checkaction
if "%1%" == "start" goto start_component
if "%1%" == "START" goto start_component
if "%1%" == "stop" goto stop_component
if "%1%" == "STOP" goto stop_component
if "%1%" == "status" goto status_component
if "%1%" == "STATUS" goto status_component
if "%1%" == "dump" goto dump_component
if "%1%" == "DUMP" goto dump_component
if "%1%" == "launch" goto launch_component
if "%1%" == "LAUNCH" goto launch_component
if "%1%" == "ping" goto ping_component
if "%1%" == "PING" goto ping_component
if "%1%" == "pinginternal" goto pinginternal_component
if "%1%" == "PINGINTERNAL" goto pinginternal_component
if "%1%" == "enable" goto enable_component
if "%1%" == "ENABLE" goto enable_component
if "%1%" == "disable" goto disable_component
if "%1%" == "DISABLE" goto disable_component
if "%1%" == "import" goto import_component
if "%1%" == "IMPORT" goto import_component
if "%1%" == "export" goto export_component
if "%1%" == "EXPORT" goto export_component
if "%1%" == "CONFIGURE" goto configure_component
if "%1%" == "configure" goto configure_component
@echo "Action unknown. Supported Actions: {START | STOP | STATUS | PING | ENABLE | DISABLE | IMPORT | EXPORT | CONFIGURE}"
goto end
:start_component
if "%2%" == "oms" goto start_oms
if "%2%" == "OMS" goto start_oms
if "%2%" == "paging" goto start_paging
if "%2%" == "PAGING" goto start_paging
@echo "Component unknown. Supported Components: {OMS | PAGING }"
goto end
:launch_component
if "%2%" == "oms" goto launch_oms
if "%2%" == "OMS" goto launch_oms
if "%2%" == "paging" goto launch_paging
if "%2%" == "PAGING" goto launch_paging
@echo "Component unknown. Supported Components: {OMS }"
goto end
ing_component
if "%2%" == "oms" goto ping_oms
if "%2%" == "OMS" goto ping_oms
@echo "Component unknown. Supported Components: {OMS }"
goto end
inginternal_component
if "%2%" == "oms" goto ping_oms_internal
if "%2%" == "OMS" goto ping_oms_internal
@echo "Component unknown. Supported Components: {OMS }"
goto end
:configure_component
if "%2%" == "RWS" goto configure_webserver
if "%2%" == "rws" goto configure_webserver
@echo "Component unknown. Supported Components: {RWS}"
goto end
:start_oms
net start OracleOraHome92ManagementServer
goto end
:launch_oms
SET OMS_ID=%3%
SET CREDENTIALS=%4%
SET STARTMODE=start
SET OMS_NOHUP_FILE=C:\oracle\ora92\sysman\log\oms.nohup
:launch_oms_only
%JRE% -Doms.startMode=%STARTMODE% -DORACLE_HOME=C:\oracle\ora92 -Doms.id=%OMS_ID% -DORBdisableLocator=true -DOEM.JRE="%JRE%" -Djdbc.backward_compatible_to_816=true -%CLASSPATH_QUAL% "%CLASSPATHADD%" oracle.sysman.vxa.VxaAppServer %CREDENTIALS% >>%OMS_NOHUP_FILE% 2>&1
if "%errorlevel%" == "56" goto oms_init_fail
if "%errorlevel%" == "0" goto oms_normal_shutdown
:check_restart
REM Check whether OMS has to be restarted or not
set OMS_RSTRT_CHK_FILE=%OHOME%\sysman\config\oemCheckRestart.bat
set OMS_RESTART=0
%JRE% -DORACLE_HOME=C:\oracle\ora92 -%CLASSPATH_QUAL% "%CLASSPATHADD%" oracle.sysman.vxa.VxaCheckOMSRestart %OMS_MAX_ABNORMAL_EXIT% %OMS_TIME_DELTA% PREV_DATE %PREV_DATE% NUM_ABORTS %NUM_ABORTS% OMS_RESTART > %OMS_RSTRT_CHK_FILE%
@call %OMS_RSTRT_CHK_FILE%
del %OMS_RSTRT_CHK_FILE%
if "%OMS_RESTART%" == "0" goto no_restart
goto restart
:restart
echo Restarting the Oracle management Server.... >>%OMS_NOHUP_FILE%
set STARTMODE=restart
goto launch_oms_only
:no_restart
@echo "Management server thrashing. Exiting oemctrl.bat" >>%OMS_NOHUP_FILE%
goto end
ms_init_fail
@echo "Could not start management server. Initialization failure" >>%OMS_NOHUP_FILE%
@echo "Management server startup failed. Check the file %OMS_NOHUP_FILE% for details"
goto end
ms_normal_shutdown
@echo "Management server shutdown normally" >>%OMS_NOHUP_FILE%
goto end
ing_oms
%JRE% -DORACLE_HOME=C:\oracle\ora92 -DORBdisableLocator=true -Doem.BootPort=7771 -Djdbc.backward_compatible_to_816=true -%CLASSPATH_QUAL% "%CLASSPATHADD%" oracle.sysman.vxa.VxaOMSPing
goto end
ing_oms_internal
SET OMS_ID=%3%
%JRE% -DORACLE_HOME=C:\oracle\ora92 -DORBdisableLocator=true -Doem.BootPort=7771 -Djdbc.backward_compatible_to_816=true -%CLASSPATH_QUAL% "%CLASSPATHADD%" oracle.sysman.vxa.VxaOMSPing %OMS_ID%
goto end
:start_paging
net start OracleOraHome92PagingServer
goto end
:launch_paging
%JRE% -DORACLE_HOME=C:\oracle\ora92 -DORBdisableLocator=true -Doem.BootPort=7771 -Djdbc.backward_compatible_to_816=true -%CLASSPATH_QUAL% "%CLASSPATHADD%" oracle.sysman.vnn.VnnPagingServer
goto end
:stop_component
if "%2%" == "oms" goto stop_oms
if "%2%" == "OMS" goto stop_oms
if "%2%" == "paging" goto stop_paging
if "%2%" == "PAGING" goto stop_paging
(more info but I left it out)