Oracle static registration and dynamic registration details, oracle static
I. Overview:
Oracle 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. Static registration:
Static registration is to read the configuration of the listener. ora file when the instance starts, 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, the content in listener. ora is 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 a single instance and the Instance name is orcl. It provides two external services: orcl and orcl1.
3. 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.
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, listener. the content in ora is as follows: SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = D: oracleproduct10.2.0db _ 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). To register with a non-default LISTENER, you need to configure the local_listener parameter!
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 an explicit value for the initialization parameters service_names and instance_name is recommended. Because if the listener needs to be restarted during database operation. when the values of service_names and instance_name are explicitly set in the ora file, the PMON process of each database completes dynamic registration within a short period of time.
4. query whether a service is static registration or dynamic registration:
You can run the lsnrctl status Command to check whether a service is registered statically or dynamically.
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.