Dynamic Registration and static registration of Oracle Listener

Source: Internet
Author: User

1. What is registration?

Registration is to register the database as a service to the listener. The client does not need to know the Database Name and Instance name. It only needs to know the service name provided by the database to external users and can apply to connect to the database. The service name may be the same or different from the instance name.

When the database server is started, the database server registers the corresponding service with the listener (whenever a database is started, two messages are registered to the listener by default: the instance and service corresponding to the database server .)

As a result, there is a Listener (Listener) between the database server and the client. In the Listener, the service name corresponding to the database is recorded (one database may have multiple service names). When the client needs to connect to the database, only the service name is required, you can establish a connection between the client and the server.

Ii. Dynamic Registration

When an instance is started, the PMON process dynamically registers the instance and service to the listener according to the instance_name and service_names parameters in init. ora.

First, specify the instance_name and service_names values in init. ora. In sqlplus, you can use show parameter service_names and show parameter instance_name to view the values of these two parameters.

The instance value registered to the listener is obtained from the instance_name parameter in the init. ora file. If this parameter is not set, it will take the value of db_name In the init. ora file. If you configure it in RAC, you must set the instance_name parameter for each instance in the cluster to a unique value.

The service value registered to the listener is obtained from the service_names parameter in the init. ora file. If no value is set for this parameter, the database Concatenates the values of db_name and db_domain In the init. ora file to register itself. If you choose to provide the service_names value, you can use a fully qualified name (such as orcl.Oracle.com) or an abbreviated name (such as orcl ). If you select the abbreviated name and set the db_domain parameter, the Service registered to the listener will be a combination of service_name and db_domain values. For example, the following settings will cause the service orcl.oracle.com to be registered to the listener:

Db_domain = oracle.com

Service_names = orcl;

When dynamic registration is adopted, the content in listener. ora is as follows:

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(SID_NAME = PLSExtProc)

(ORACLE_HOME = D: \ oracle \ product \ 10.2.0 \ db_1)

(PROGRAM = extproc)

)

)

You can specify multiple service values in the service_names parameter, which are separated by commas (,). This is useful for sharing server configurations.

By default, dynamic registration is only registered to the default LISTENER (the name is LISTENER, the port is 1521, and the protocol is TCP), because pmon only dynamically registers a LISTENER with port equal to 1521, otherwise, pmon cannot dynamically register listener. If you need to register with a non-default listener, you need to configure the local_listener parameter!

Add the listener information to the tnsnames. ora file. Note: It is the tnsnames. ora file, because pmon needs to read relevant information from tnsnames. ora when dynamically registering a listener.

LISTENER =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = DaveDai) (PORT = 1522 ))

)

Run the following command with sys:

SQL> alter system set local_listener = listener;

SQL> alter system register;

Or:

SQL> alter system set LOCAL_LISTENER = '(ADDRESS = (PROTOCOL = TCP) (HOST = DaveDai) (PORT = 1522 ))';

SQL> alter system register;

The system has been changed.

$ Lsnrctl status listener

If the service_names and instance_name values are not explicitly set, dynamic registration only occurs when the database is started after the listener is running. In this case, if the listener is restarted later, dynamic Registration Information will be lost. Obviously, it is best to start the listener before all databases are started. This will avoid the loss of Dynamic Registration Information caused by restarting the listener if the values of service_names and instance_name are not explicitly set.

Setting explicit values for the initialization parameters service_names and instance_name is a good practice. Even if you do not set them, Oracle will generate a default value for Dynamic Registration (based on db_name and db_main ). The reason for this is that if the listener restarts after the database is started, its dynamic registration behavior will be slightly different. if the listener restarts after the database is running. when the values of service_names and instance_name are explicitly set in the ora file, the PMON process of each database automatically registers the database after a short period of time.

If you want to implement failover or Server Load balancer during connection, or you want to configure transparent distributed connections between instances in RAC, it is necessary to use the service_names parameter. To enable these functions, you only need to set service_names in the database parameter file of each instance to the same value and reference this value in the service_name setting of the Client Connection Request.

If the service_names and instance_name values are not explicitly set, dynamic registration only occurs when the database is started after the listener is running. In this case, if the listener is restarted later, dynamic Registration Information will be lost. Obviously, start the listener on the server before starting any database, and completely avoid restarting the listener.

In addition, you can use the following command in SQL * PLUS:

SQL> ALTER SYSTEM REGISTER;

Manually register the service value in the listener at any time when the database is opened. This command is useful for replacing the location service value lost due to listener restart, and its registration Location value is exactly the same as the value set by Dynamic Registration at database startup.

Dynamic listening:

After the oracle listener runs, when the oracle instance is open, it dynamically registers its service_names and instance_name with the listener.

The default instance_name is db_name.

The default value of service_names is db_name.db_domain.

  • 1
  • 2
  • Next Page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.