Modifying and Deleting a Listener

You can modify a listener in one of two ways. Permanent modifications need to be made by editing the listener.ora file. However, you sometimes need to stop and restart the listener before any such changes take effect. You can also change a currently running listener from the Listener Control utility’s command prompt. You are somewhat limited, though, in the changes you can make using the Listener Control utility.

The process for deleting a listener also requires that you edit your listener.ora file. In addition, there are some Windows NT-specific quirks that you need to be concerned about if you happen to be running on that platform.

Modifying a Listener

To change a listener’s definition by modifying your listener.ora file, follow these steps:

  1. Edit listener.ora, and make whatever changes you need.

  2. Stop the listener.

  3. Restart the listener.

This is all very straightforward. When you restart the listener, it reads your new version of listener.ora, and any changes you made take effect.

It’s not always convenient, though, to stop a listener. If you’re in a production environment, and you only have one listener, then no users will be able to connect to the database for that brief period of time during which the listener is stopped. Fortunately, there are some ways to make changes while the listener is running.

Using the Listener Control utility to modify a listener

The Listener Control utility now allows you to change most listener parameters while the listener is running. Listener Control implements several commands tied to specific parameters. These are summarized in Table 4.1. There’s also the RELOAD command, which is discussed later in Section

Table 4-1. Commands to Change Listener Parameters




























Other SET commands exist besides those shown in Table 4.1. However, they affect the operation of the Listener Control utility, and not that of the listener itself.

As you can see, most of the commands described in Table 4.1 are SET commands. Each SET command allows you to change the value of a specific listener.ora parameter. For each SET command, there is also a corresponding SHOW command. Here is an example of some of these commands being used:

LSNRCTL> SHOW trc_level
LISTENER parameter "trc_level" set to off
The command completed successfully
LSNRCTL> SET trc_level admin
LISTENER parameter "trc_level" set to admin
The command completed successfully
The command completed successfully
LSNRCTL> SHOW trc_level
LISTENER parameter "trc_level" set to off
The command completed successfully

Changes made using the commands shown in Table 4.1 only affect the running listener. They don’t normally result in modifications to listener.ora. You can, however, save them to listener.ora if you want to. You can also configure the listener to do this automatically.

Saving your listener’s configuration

Using the SAVE_CONFIG command, you can write your current listener information back to the listener.ora file. This is helpful if you’ve used SET commands to make changes to the running listener. By writing the new configuration back to listener.ora, you make those changes permanent.

To save the configuration of the current listener, use the SAVE_CONFIG command as shown in this example:

The command completed successfully

You may optionally specify a listener name following the command. This allows you to save the configuration for a listener other than the one that you’ve made current. For example:

SAVE_CONFIG production_listener

When you execute a SAVE_CONFIG command, the Listener Control utility compares the current listener settings with that listener’s parameters in the listener.ora file. If there are any differences, a new listener.ora file is generated to reflect the current settings. The old listener.ora file is renamed to listener.bak before being overwritten. If a change affects a parameter currently in your listener.ora file, that parameter entry is modified. If a change requires one or more parameters to be added to listener.ora, they are bracketed by comments. For example:

#----ADDED BY TNSLSNR 26-APR-00 16:07:29---

SAVE_CONFIG writes the current settings of any Listener Control parameters and also writes the current SID_LIST. SAVE_CONFIG never affects the listener address entry in the listener.ora file.

Automatically saving changes

You can automate the process of saving changes to listener.ora by having the listener save its configuration every time you stop it using the Listener Control utility’s STOP command. To enable this feature, set the SAVE_CONFIG_ON_STOP parameter to ON in your listener.ora file. Remember that the listener name must be appended to this parameter. If your listener name is PRODUCTION_LISTENER, then your parameter setting should look like this:


With this setting enabled, every time you issue a STOP command from the Listener Control utility, the listener will execute the equivalent of a SAVE_CONFIG command.


SAVE_CONFIG_ON_STOP only works when you use Listener Control to stop the listener. If your server goes down, or if you kill the listener service from the operating-system prompt, the listener’s configuration is not saved. If you’re on Windows NT, and you stop the listener service from the Services control panel, the configuration is not saved. The same holds true if you stop the listener using a NET STOP command. For these reasons, it’s best not to depend too much on this feature.

You can enable this feature while the listener is running by issuing a SET SAVE_CONFIG_ON_STOP ON command. Then when you next stop the listener, that change, along with any other changes that you’ve made, is written out to listener.ora.

Reloading listener parameters

The Listener Control utility’s RELOAD command presents you with another mechanism for changing listener parameters while a listener is running. Using RELOAD, you can change any control parameters and SID_LIST parameters. First, edit listener.ora and make whatever changes you want to make. Then start the Listener Control utility and execute the RELOAD command. This example shows RELOAD being used to reload the parameters for the listener named PRODUCTION_LISTENER:

The command completed successfully

While RELOAD can be used to change control parameters and SID_LIST parameters, it cannot be used to make listener address changes. If you make changes to a listener’s address entry in listener.ora, you have to stop and restart the listener in order for those changes to take effect.

Deleting a Listener

To delete a listener, you need to do the following:

  1. Stop the listener.

  2. Delete the listener’s parameters from listener.ora.

  3. Delete the listener service—on Windows NT and Windows 2000 only.

The first two steps are straightforward and easy and, if you’re running on Linux or Unix, that’s all you need to do in order to delete a listener. On Windows systems, you have the added complexity of removing the NT service associated with the listener.

Listener service names on Windows NT

Beginning with Oracle8i, Release 8.1.5, Oracle uses the following naming convention for listener services on Windows NT:

"Oracle"+"Oracle Home Name"+"TNSListener"+"Listener Name"

You can get the listener name from your listener.ora file. That will probably be enough for you to identify the specific service to delete. If you happen to be running two listeners with the same name, but from two different Oracle Homes, you will need to take the Oracle Home name into account as well. The Oracle Home name shows up in the Start menu as part of the name for the Oracle program group. Figure 4.8 shows how the service for the listener named PRODUCTION_LISTENER appears in the Services control panel.

The NT service for the listener named PRODUCTION_LISTENER

Figure 4-8. The NT service for the listener named PRODUCTION_LISTENER

Once you’ve identified the specific listener service, you can delete it by running regedit and deleting the listener’s key from the registry.

Deleting a service from the registry

To delete a Windows NT service, you should first run the Services control panel and check to be sure that the service has been stopped. Once you’ve done that, run regedit and navigate to the following key:


Underneath the Services key you will see a long list of keys—one for each service on your machine. Figure 4.9 shows a list of keys for services that includes the key for the listener named PRODUCTION_LISTENER:

The registry key for the listener named PRODUCTION_LISTENER

Figure 4-9. The registry key for the listener named PRODUCTION_LISTENER

Find the key under Services that matches the name of the service you want to delete. Click on that key to select it, and press the Delete key. You’ll be asked to confirm your deletion—be certain that you are deleting the correct key before you confirm the delete. Once you’ve deleted the key, thereby deleting the service, you’ll need to reboot the machine.


Be extremely careful when running regedit. There is no undo function. The consequences of deleting the wrong registry key can be quite dire. If you’re not certain of your ability to recover from a mistake, talk to your system administrator.

Get Oracle Net8 Configuration and Troubleshooting now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.