Oracle static registration and dynamic registration

Source: Internet
Author: User

One, what is registration?

Registration is the registration of the database as a service to the listener. The client does not need to know the database name and instance name, just know that the database can be used to connect to the database with the service name provided externally. This service name may or may not be the same as the instance name.

During the database server startup process, the database server registers the appropriate service with the listener (whenever a database is started, two messages are registered to the listener by default): The database server's corresponding instance and service. )

This is equivalent to: there is a listener (Listener) between the database server and the client, and in the Listener, the corresponding service name (one database may have multiple service names) is logged, and when the client needs to connect to the database, only the service name is provided. You can establish a connection between the client and the server.

Second, static registration

Static registration is the configuration that reads the Listener.ora file when the instance is started, registering the instance and service to the listener. Whenever you start a database, two messages are registered to the listener by default: the instance and service corresponding to the database server.

When statically registered, the Global_dbname in Listener.ora provides the service name, and the Sid_name in Listener.ora provides the registered instance name.

When a static registration method is adopted, the contents of the Listener.ora are as follows:

Sid_list_listener =

(Sid_list =

(Sid_desc =

(Sid_name = Plsextproc)

(Oracle_home = d:oracleproduct10.2.0db_1)

(program = Extproc)

)

(Sid_desc =

(Global_dbname =ORCL)

(Oracle_home = d:oracleproduct10.2.0db_1)

(Sid_name =ORCL)

)

(Sid_desc =

(Global_dbname =ORCL1)

(Oracle_home = d:oracleproduct10.2.0db_1)

(Sid_name =ORCL)

)

)

This file indicates that the database is single-instance, with an instance named ORCL, providing two services outside: ORCL and ORCL1

Third, dynamic registration

Dynamic registration is when the instance is started Pmon the process dynamically registers instances and services into listener according to the Instance_name,service_names two parameters in Init.ora.

First you specify the values of the Instance_name,service_names two parameters in Init.ora. The values of these two parameters can be viewed under sqlplus by the show parameter Service_names, and the parameter instance_name.

The instance value registered to the listener is obtained from the instance_name parameter in the Init.ora file. If the parameter is not set, it takes the value of the db_name in the Init.ora file.

The service value registered to the listener is obtained from the parameter Service_names in the Init.ora file. If the parameter is not set, the database will splice the values of db_name and Db_domain in the Init.ora file to register itself. If you choose to provide a service_names value, you can use a fully qualified name (such as a orcl.oracle.com) or an abbreviated name (such as ORCL). If you select an abbreviated name and set the Db_domain parameter, the service registered to the listener will be a concatenation of the service_name value and the Db_domain value. For example, the following settings will cause the service orcl.oracle.com to be registered in the listener:

Db_domain=oracle.com

SERVICE_NAMES=ORCL;

When a dynamic registration method is adopted, the contents of the Listener.ora are as follows:

Sid_list_listener =

(Sid_list =

(Sid_desc =

(Sid_name = Plsextproc)

(Oracle_home = d:oracleproduct10.2.0db_1)

(program = Extproc)

)

)

Optionally, you can specify multiple service values in the Service_names parameter, with commas between the values, which is useful for shared server configuration.

Dynamic registration defaults to the default listener only (name is listener, port is 1521, protocol is TCP), you need to configure Local_listener parameters if you need to register with a Non-default listener!

If the values for Service_names and instance_name are not explicitly set, dynamic registration occurs only if the database is started after the listener is run, in which case the dynamic registration information will be lost if the listener subsequently restarts. Obviously, it is best to start the listener before all databases are started, so that you avoid the loss of dynamic registration information that is caused by restarting the listener without explicitly setting the values for Service_names and instance_name.

Setting explicit values for initialization parameters Service_names and instance_name is a desirable method and recommendation. Because if the listener restarts during the database run, the Pmon process for each database will complete dynamic registration in a very short time only if you explicitly set the Service_names and instance_name values in the Init.ora file.

Four, query a service is static registration or dynamic registration

You can use the command Lsnrctl status to see whether a service is statically registered or dynamically registered.

The instance state is a unknown value indicating that the service is a statically registered setting. When the listener is used to indicate that it does not know any information about the instance, it checks that the instance exists only if the client issues a connection request.

Dynamically registered databases are indicated by state ready or state blocked (for an alternate database) in state information. Regardless of when the database is closed, the dynamically registered database is dynamically logged off from the listener, and the information associated with it disappears from the status list. This way, the listener always knows its state, regardless of whether the database is running or closed. This information will be used for the fallback (fallback) and load balancing of the connection request.

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.