All about Oracle Listener Dynamic Registration and static registration

Source: Internet
Author: User

All about Oracle Listener Dynamic Registration and static registration 1. What is 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. 2. Dynamic Registration: When the 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 <SID>. ora. Specify the values of instance_name and service_names in init <SID>. 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 <SID>. 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 <SID>. ora file. If no value is set for this parameter, the database Concatenates the values of db_name and db_domain In the init <SID>. 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. comservice_names = orcl; Service "orcl.oracle.com" has 1 instance (s ). instance "orcl1", status READY, has 1 handler (s) for this service... when the dynamic registration method is adopted, listener. the content in 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. The values are separated by commas (,). Server configuration is very useful. 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. For example, LISTENER = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = DaveDai) (PORT = 1522) and then run it with sys using the token: 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 values of service_names and instance_name are not explicitly set, dynamic registration only occurs when the database is started after the listener is run. 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 when 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_domain ). 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 also run the SQL * PLUS command: SQL> ALTER SYSTEM REGISTER; manually REGISTER the service value in the listener whenever the database is opened. This command is useful for replacing the service value lost due to listener restart, and its registered value is exactly the same as the value set by Dynamic Registration at database startup. Dynamic Registration: After the oracle listener runs, when the oracle instance is open, it dynamically registers its service_names and instance_name with the listener. Instance_name is db_name by default, while service_names is db_name.db_domain by default. Static registration is to read the configuration of the listener. ora file when the instance is started, and register the instance and service to 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. During static registration, GLOBAL_DBNAME in listener. ora provides the service name externally, and SID_NAME in listener. ora provides the registered Instance name. When static registration is adopted, listener. the content in 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 )) (SID_DESC = (GLOBAL_DBNAME = orcl) (ORACLE_HOME = D:/oracle/product/10.2.0/db_1) (SID_NAME = orcl) (SID_DESC = (GLOBAL_DBNAME = orcl1) (ORACLE_HOME = D:/oracle/product/10.2.0/db_1) (SID_NAME = orcl) Note: ORACLE_HOME = D:/oracle/product/10.2.0/db_1 and ORA CLE_HOME = D:/oracle/product/10.2.0/db_1/is different. The two methods correspond to different shared memory segments with the same ORACLE_SID. This file indicates that the database is a single instance, and the Instance name is orcl. It provides two external services: orcl and orcl1 static listening: After the oracle instance is running, the listener starts according to listener. configure ora to register the corresponding service. Global_dbname corresponds to the external service name of oracle, that is, service_names in the initialization parameter, while sid_name corresponds to the name of the oralce instance, that is to say, the instance_name in the initialization parameter has a dynamic listener. Why do we need a static listener? The reason is as follows: 1. the listener is not started earliest. The oracle instance starts first. listener restart 3. oracle instances do not have open. 4. query whether a service is static registration or dynamic registration. You can use the command lsnrctl status to check whether a service is static registration or dynamic registration. When the instance status is UNKNOWN, it indicates that this service is set for static registration. The listener is used to indicate that it does not know any information about the instance. It checks whether the instance exists only when the customer sends a connection request. Dynamically registered databases are indicated by status READY or status BLOCKED (for a backup database) in the status information. No matter when the database is closed, the dynamically registered database will be logged out from the listener dynamically, and the related information will disappear from the status list. In this way, the listener always knows its status whether the database is running or closed. This information will be used to connect to the request's back-to-back (fallback) and load balancing.

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.