Currently browsing category

Tips and Tricks


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.


Keyboard Shortcut for Copy & Paste in Command Prompt

Keyboard ShortcutIf you are old school like me and prefer to stay closer to the keyboard rather than use the mouse, the copy and paste in Windows Command Prompt can be a bit tricky. But as usual the menu options provided by Windows allows to copy and paste without using a mouse. Here’s the keyboard shortcut to perform the copy and paste operation:

[ Alt + Space -> E -> K ] will take you to mark mode.
Once in mark mode use the keyboard up/down/left/right keys to get to the start point, then use Shift + [up/down/left/right] keys to select the text.
Now press enter to copy the text.

[ Alt + Space -> E -> P ] will paste the text in the command prompt.

Sometimes simple things which are straight forward take most of our time, simple tricks like these can speed up the tasks and save time.