Creating an Oracle service on Windows
From Oracle FAQ
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,
- -sid is the Oracle SID. You can specify -service SERVICENAME instead.
- -intpwd is the internal password
- -startmode can be A(utomatic) or M(anual); this refers to whether or not starting the service automatically opens the database.
- -pfile is the fully qualified location of the init.ora file
- -timeout refers to the number of seconds Windows will give the service to respond to a "Start" command before timing out.
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:
- -NEWSID lets you rename the SID
- -SHUTMODE refers to the "alter database shutdown xxx" command issued when the service is stopped, and can be A(bort), I(mmediate) or N(ormal) HKLM\Oracle\Homei\ORA_sid_SHUTDOWNTYPE.
- -SHUTTYPE refers to what stops when you issue the "stop service" command: service, instance or both. If you don't specify -SHUTTYPE for a service, Oracle checks the registry for the current setting.
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
Republished with permission from Natalka Roshak. Original URL: http://www.rdbms-insight.com/toolkit/oradim.php