How to create Oracle database service and listener on Windows 2003 server

Jephe Wu - http://linuxtechres.blogspot.com

Environment
: Windows 2003 server SE, upgrading Oracle 10.2.0.4 standard edition to 11.2.0.2
Objective: to be familiar with Oracle service and listener creation and deletion in case needed.
Summary

Normally, if you install Oracle 11g on Windows, it'll create listener and service automatically. In case you have deleted them and need to create back, here are the steps:


Steps

1. delete Oracle Windows service (database and listener)


a. manually delete from registry

run regedit or regedt32
Open regedit and browse to the following key
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services

Find the service name 'OracleOraDb11g_home1TNSListener' or 'OracleOraDb10g_home1TNSListener'
right click it and export to a .reg file, then delete the key. (You might need to reboot server as refresh might not be able to remove service name completely, if that's the case, try also the following sc command to remove it)

b. use sc to delete service

backup the registry according to point a, then run:

sc delete OracleOraDb11g_home1TNSListener

2. create Oracle Windows service - Listener
a. sc

Create listener service:
sc create OracleOraDb11g_home1TNSListener [binPath= "C:\oracle\product\11.2.0\dbhome_2\BIN\TNSLSNR.exe"]
note: after binPath=, there must be a space there


b. run netca to create listener service by Oracle


Start -> All programs -> Oracle - OraDb11g_home1 -> Configuration and Migration Tools -> Net Configuration Assistant

When asking for Listener Name, don't change anything, just leave the default name 'LISTENER' there, it will create service name as OracleOraDb11g_home1TNSListener

3. create Oracle Windows service - database

a. stop OracleServiceorcl service (orcl is the sid here)

net stop OracleServiceORCL

b. use oradim to delete service

c:\> oradim -delete -sid orcl

c. use oradim to create again


C:\> ORADIM -NEW -SID SID -INTPWD PASSWORD -MAXUSERS USERS
 -STARTMODE AUTO -PFILE ORACLE_HOME\DATABASE\INITSID.ORA

Or
c:\> oradim -new -id orcl -startmode auto

to use OS authentication

SID    The same SID name as the SID of the database you are upgrading.
PASSWORD    The password for the new release 10.2 database instance. This is the password for the user connected with SYSDBA privileges. The -INTPWD option is not required. If you do not specify it, then operating system authentication is used, and no password is required.
USERS    The maximum number of users who can be granted SYSDBA and SYSOPER privileges.
ORACLE_HOME    The release 10.2 Oracle home directory. Ensure that you specify the full path name with the -PFILE option, including drive letter of the Oracle home directory.



4. References

a. http://publib.boulder.ibm.com/infocenter/ltscnnct/v1r0/index.jsp?topic=/com.ibm.help.lotus.connections.doc/t_db_oracle_listener.html
b. http://psoug.org/reference/oradim.html
c. http://www.theeldergeek.com/add_a_service_in_windows_xp.htm