Oracle Local Listener Static and Dynamic Registration of Services

YouTube video

In this article, we will discuss the concepts of local listener and the static and dynamic registration of database instances or services with the listener. Understanding these aspects is crucial for database administrators (DBAs) to effectively manage the relationship between the instance and the listener. We will use Oracle 19c database as an example throughout this discussion.

Static Registration

Static registration refers to hardcoding the information about the instance into the listener configuration file, known as the listener.ora file, located in the network admin directory under the Oracle home. This static registration is done by manually editing the file and adding the necessary details. The listener then reads this file to identify the instances registered with it.

In our test scenario, we have a database named “red test1” and a listener named “listener_19c” running on port 1522. By checking the listener.ora file, we can see the statically registered instance, which in this case is “red test1.”

Dynamic Registration

Dynamic registration, on the other hand, occurs when the pmon process associated with an instance supplies the registration information to the listener. This dynamic registration allows the listener to receive real-time updates about the instances and their services. The information provided by the pmon process includes the instance name, status, associated database services, server mode (dedicated or shared), and load balancing activities.

Dynamic registration is more versatile and flexible compared to static registration since it provides useful and up-to-date information to the listener.

Checking Listener Status

To understand the registration process further, let’s first check the status of our listener named “listener_19c.” We can use the command lsnrctl status listener_19c to display the status. This command also provides the location of the listener.ora file, which in our case is in the Oracle home network admin folder.

Static Registration Limitations

Once the static registration is performed, the listener doesn’t have a way to determine the exact status of the instance. In our example, even though the instance “red test1” is up and running, the listener shows its status as “unknown.” This limitation occurs because static registration doesn’t allow real-time updates between the listener and the instance.

Removing Static Entry for Dynamic Registration

To see the dynamic registration in action, we will remove the static entry for our instance and restart both the listener and the instance. Removing the static entry means deleting the corresponding section in the listener.ora file that specifies the instances to be registered.

After removing the entry, we restart the listener and then restart the instance itself. Upon checking the listener status again, we can see that no services are registered with the listener. This situation occurs because the pmon process responsible for dynamic registration hasn’t provided the necessary information to the listener yet.

Changing the Listener Port

Next, we will change the listener port from 1522 to the default port 1521, which is commonly used for Oracle listeners. We want to test if the pmon process dynamically registers the instance when using the default port. Instead of restarting the instance, we can wait for 60 seconds, as the pmon process usually updates the listener every 60 seconds.

By modifying the listener.ora file and restarting the listener, we set the port to 1521. After waiting for 60 seconds or restarting the instance, we check the listener status again. This time, we see that the instance information, along with the services associated with it, is successfully registered with the listener.

Handling Non-Default Ports

In situations where a non-default port is used, such as 1522 in our example, we need to set the local listener initialization parameter for the instance. The local listener parameter should contain either the description of the listener or a TNS entry that points to the listener’s description.

To demonstrate this, we revert the listener’s port back to 1522 and restart it. We then connect to the database and check the value of the local listener parameter, which is currently blank. We set the local listener parameter to the listener’s description, wrapped in single quotes, using the alter system set local_listener command.

After setting the parameter, we can see that the pmon process dynamically registers the instance again, even though it’s using a non-default port (1522). This dynamic registration is possible because the local listener parameter instructs the pmon process to provide the necessary information to the listener.

Alternatively, instead of specifying the entire listener description, we can create a TNS entry in the tnsnames.ora file that points to the listener. By creating this TNS entry, we can set the local listener parameter to the TNS alias we created. This method offers a simpler and more manageable way to configure the local listener parameter.

Troubleshooting Dynamic Registration Issues

In some cases, due to issues or bugs, the pmon process might not be able to dynamically register the instance with the listener, even when the local listener parameter is properly set. In these situations, we can use the alter system register command to force the pmon process to register the instance or its services with the listener.

Executing the alter system register command notifies the pmon process to update the listener with the instance’s registration information. However, it’s important to note that the local listener parameter must be set appropriately for this command to work.

Key Takeaways

In today’s tutorial, we focused on the local listener and the static and dynamic registration of services. Here are the key points we covered:

  1. Static registration involves manually adding the instance details to the listener.ora file, while dynamic registration is performed by the pmon process.
  2. Dynamic registration provides real-time updates about the instance, including status, services, server mode, and load balancing.
  3. Static registration has limitations, as the listener cannot determine the exact status of the instance.
  4. Removing static entries and restarting the listener and instance allows dynamic registration to take place.
  5. Changing the listener port to the default port 1521 enables automatic dynamic registration by the pmon process.
  6. When using non-default ports, the local listener parameter must be set to provide the necessary details.
  7. If dynamic registration encounters issues, the alter system register command can force the pmon process to register the instance or its services with the listener.

We hope you found this tutorial helpful. Don’t forget to hit the like button and subscribe to our channel for more informative videos on Oracle DBS and related topics.