Wednesday, October 26, 2022

 

Windows: How To Delete and Recreate the TNS Listener Service When the Service Fails To Start Consistently At Machine Reboot (Doc ID 313250.1)


APPLIES TO:

Oracle Net Services - Version 8.1.7.4.0 and later
Microsoft Windows x64 (64-bit) - Version: 2008 R2
Microsoft Windows (32-bit)
Microsoft Windows (32-bit)Microsoft Windows

GOAL

Oracle TNS Listener service fails to start automatically at boot time (e.g. after moving Windows Server to new location) or fails to start manually.

SOLUTION

You need to re-create the Windows service associated to the Oracle listener by deleting the Windows service and creating a new service for the Oracle TNS Listener.

1. Deleting the service

At your earliest convenience, or next scheduled maintenance window, delete and recreate the Windows service associated to the Oracle TNS Listener. You can do this either with the help of a tool (recommended) or by hand-editing the registry. In both cases you need to stop the listener service before making any changes.

Using a tool
There are quite a few tools to manipulate Windows services, in the Resource Kit or from third parties. Also there is a tool called SC and which is available in the base Windows distribution (at least for Windows XP and Windows 2003).

  1. Lookup the windows service name that you want to remove — use Properties in the Windows Services panel to copy the full name
  2. Open a Command Prompt window and run the following:
    sc delete <your_windows_Service_name>
  3. Check that the Windows service has been removed — use F5/Refresh in the Windows Services panel

In case you do not have the SC tool available then you need to download the Windows Resource Kit — there you will find the instsrv.exe tool.

  1. Lookup the windows service name that you want to remove — use Properties in the Windows Services panel to copy the full name
  2. Open a Command Prompt Window and run the following:
    instsrv /deleteService <your_windows_Service_name>
  3. Check that the Windows service has been removed — use F5/Refresh in the Windows Services panel


Manually editing the Windows Registry

Warning: editing the Windows Registry by hand is dangerous and may render your system unusable. Proceed at your own risk !


You need to follow these steps:

  • Launch the Registry Editor (e.g. Start / Run / regedit )
  • Drill down to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
  • Locate and delete the the key which contains your Oracle Home name and your listener name (e.g. OracleOraHomeTNSListenerName)
  • Reboot the system

 

2. Creating the new service

When started and logged on as the Oracle user, go to a Command Prompt and start the listener:

lsnrctl start <listener_name>

Replace <listener_name> with the name of your listener; if you are operating on the default listener then you may use the value LISTENER or leave it empty.

An OS error 1060 will be seen (which is normal as the Windows service is missing and is being created); the listener should start correctly.

3. Test the listener

Once started the listener is started, check that a Windows service for the TNS Listener was created in the Window Services panel and set to startup automatically (change if necessary). Then test the automatic listener startup by performing another reboot.

No comments:

Post a Comment

  RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time https://shivanandarao-oracle.com/2012/12/05/rman-20207-until-time-or-re...