Creating an Oracle service on Windows

Home

Toolkit:

My OraFAQ Blog

Contact me

When you create a new Oracle database on a Windows machine, you must also start a new service. Oracle provides a command-line utility, ORADIM, for this purpose. Here's a typical use:

C:\oracle\ora81>oradim -new -sid PROD -intpwd SECRET -startmode A -maxusers 100 
-pfile C:\oracle\ora81\database\initPROD.ora -timeout 60

C:\oracle\ora81>

In the foregoing,

The ORADIM utility can be used to remove, edit, start, or stop a service:


C:\oracle\ora81>oradim --?
DIM-00002: Valid commands are: -DELETE, -EDIT, -NEW, -STARTUP, and -SHUTDOWN
Please enter one of the following command:
  Create an instance by specifying the following parameters:
    -NEW -SID sid | -SRVC service [-INTPWD password] [-MAXUSERS number] 
          [-STARTMODE a|m] [-PFILE file] [-TIMEOUT secs]
  Edit an instance by specifying the following parameters:
    -EDIT -SID sid [-NEWSID sid] [-INTPWD password] [-STARTMODE auto|manual] 
          [-PFILE filename][-SHUTMODE a|i|n] [-SHUTTYPE srvc|inst|srvc,inst] 
          [-TIMEOUT seconds]
  Delete instances by specifying the following:
    -DELETE -SID sid | -SRVC service name
  Startup services and instance by specifying the following parameters:
    -STARTUP -SID sid [-USRPWD password] [-STARTTYPE srvc|inst|srvc,inst] 
          [-PFILE filename]
  Shutdown services and instance by specifying the following parameters:
    -SHUTDOWN -SID sid [-USRPWD password] [-SHUTTYPE srvc|inst|srvc,inst] 
          [-SHUTMODE a | i | n]
  Query for help by specifying the following parameters: -? | -h | -help

C:\oracle\ora81>oradim -delete -sid PROD

C:\oracle\ora81>

The service will start up after creation.

Additional parameters available when -EDIT'ing a service include:

You can also use ORADIM to startup and shutdown the service, instead of using the Services control panel in the GUI. (And in fact, you should.)

C:\oracle\ora81>oradim -shutdown -sid PROD


Note: Proofread any scripts before using. Always try scripts on a test instance first. I'm not responsible for any damage, even if you somehow manage to make my scripts corrupt every last byte of your data, set your server on fire and serve you personally with an eviction notice from your landlord!
All scripts and tips © Natalka Roshak 2001-2005.
Enjoy the FREE tips folks...