Start Oracle using Windows Batch Script

Command LineIf you are a developer like me then there would generally be a stack which you would be working on, for me it is Oracle, Apache and Tomcat. Considering how heavy they are on the system and how badly they can slow down the system, I prefer to not have them startup with windows and instead start them up manually as required using windows batch scripts. Here is what I did to get the things setup:

  • Firstly, I disabled the following from starting up on each windows startup by going to ‘Run’ and entering ‘services.msc’
    • OracleMTSRecoveryService
    • OracleServiceTUXORCL (TUXORCL is my local DB)
    • OracleOraDb11g_home1TNSListener
    • TuxApache (Apache service)
    • TuxTomcatService (Tomcat service)
  • Next step is to create a window’s batch script, I created two (one for starting and the other for stopping) and the scripts looked something like below:
  • Startup Script (start_oracle_apache_tomcat.bat):
    net start OracleMTSRecoveryService
    net start OracleServiceTUXORCL
    net start OracleOraDb11g_home1TNSListener
    net start TuxApache
    net start TuxTomcatService
  • Shutdown Script (stop_oracle_apache_tomcat.bat):
    net stop TuxApache
    net stop TuxTomcatService
    net stop OracleMTSRecoveryService
    net stop OracleServiceTUXORCL
    net stop OracleOraDb11g_home1TNSListener

Note: You may need admin privileges to be able to run the scripts.

Leave a Reply