Server Listener Configuration

Source: Internet
Author: User

1. Server Listener Configuration

The Oracle listener is a process running on the database, which is responsible for listening to user connection requests. Every time a user request is received, the listener Process creates a shadow Process and forwards the request to the Shadow Process. The shadow Process continues to complete various commands submitted by the user. Once the listener process transfers the user to the Shadow process, even if the task of the listener process is completed, it continues to listen for the next user request. Therefore, the listener role is like a man-in-the-middle. It is only responsible for bridging user processes and shadow processes.

The listener works according to the configuration file. This file is called listener. ora is located in the $ ORACLE_HOME/network/admin directory. Because the listener only works on the database server, this file is only required by the server and is not required by the client. The content of this file is as follows:

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.2.51) (PORT = 1521 ))

)

)

The content of this file indicates that the listener listens on port 1521 of the IP address 192.168.2.51.

Oracle supports two connection modes: Dedicated Service and Shared Server ). The difference between the two lies in that the private mode starts a separate Process (Shadow Process) for each user connection, which is equivalent to providing a separate session channel to the server for each user, thus the name of the private. The sharing mode is used to hide a user from connecting to and sharing a process. That is, multiple users share a session channel, which is called sharing. Net Services Administrator's Guide, which mode is determined during database creation.

2. Static registration and Dynamic Registration

The server-side listening process and database are two independent processes. In other words, a physical server can run multiple databases at the same time. The specific quantity depends on the resource capacity of the server. Theoretically, it can be unlimited. However, only one listening process is required on a server. One listening process is sufficient to provide services for all databases on the server on which it is located. That is to say, the listening process is not fixed as a database service.

Because the listening process is not bound to a specific database, the listener must first know if it can find the target database to deliver user connection requests, this information can be obtained through static registration and dynamic registration.

2.1 static Configuration

The so-called static configuration means that when the listener is configured, it clearly tells the listener the information of a database, and the listener will load this part of information during the startup process. This information is also recorded in the LISTENER. ORA configuration file of the LISTENER. below is the LISTENER. ORA file with static configuration. Note that the SID_LIST_LISTENER part is the static configuration content.

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(GLOBAL_DBNAME = ORCL.192.168.2.51)

(ORACLE_HOME = C: \ oracle \ product \ 10.1.0 \ Db_1)

(SID_NAME = ORCL)

)

)

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.2.51) (PORT = 1521 ))

)

)

In this example, the LISTENER named LISTENER is responsible for connection requests from the database with SID = ORCL. The biggest problem with static configuration is that the LISTENER cannot know the real status of the database.

2.2. Dynamic Registration.

In addition to static configuration, the Oracle database can dynamically register like a listener. 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. To use the dynamic registration function, you must first initialize SERVICE_NAME and INSTANCE_NAME in the database. If the SERVER_NAME parameter is not defined, the Database uses a Global Database Name consisting of DB_NAME and DB_DOMAIN to register it in the listener. INSTANCE_NAME is the Instance name, which is usually the same as the SID value.

As long as the database is running, the PMON process automatically and periodically registers and updates information to the listener process. The DBA can also use the following command to force PMON to register immediately with the listener:

SQL> alert system register;

System altered.

Static configuration and dynamic registration have different performance statuses in the listener, which can be verified using the lsnrctl tool provided by Oracle. For example, in the following query results, there are two ORCL entries, which correspond to the same database, but the record generation method is different. The first destination State is UNKNOWN, which is generated by static configuration and the second is READY, which is generated by Dynamic Registration.

When the database is in motion, if you run the lsnrctl status Command to view the listener status, you can see two entries. Note the status differences between the two methods: the static configuration status is UNKNOWN, and the dynamic registration status is READY.

C: \ Documents ents and Settings \ Administrator> lsnrctl start

LSNRCTL for 32-bit Windows: Version 10.1.0.2.0-Production on 2011 22:04:52

Copyright (c) 1991,200 4, Oracle. All rights reserved.

Starting tnslsnr: please wait...

TNSLSNR for 32-bit Windows: Version 10.1.0.2.0-Production

System parameter file is C: \ oracle \ product \ 10.1.0 \ Db_1 \ network \ admin \ listener. ora

Log messages written to C: \ oracle \ product \ 10.1.0 \ Db_1 \ network \ log \ listener. log

Listening on: (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = 192.168.1.104) (PORT = 1521 )))

Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.104) (PORT = 1521 )))

STATUS of the LISTENER

------------------------

Alias LISTENER

Version TNSLSNR for 32-bit Windows: Version 10.1.0.2.0-Production

Start Date 28-10-2011 21:54:57

Uptime 0 days 0 hr. 0 min. 0 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File C: \ oracle \ product \ 10.1.0 \ Db_1 \ network \ admin \ listener. ora

Listener Log File C: \ oracle \ product \ 10.1.0 \ Db_1 \ network \ log \ listener. log

Listening Endpoints Summary...

(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = 192.168.1.104) (PORT = 1521 )))

Services Summary...

Service "ORCL" has 1 instance (s ).

Instance "ORCL", status UNKNOWN, has 1 handler (s) for this service...

Service "ORCL" has 1 instance (s ).

Instance "ORCL", status READY, has 1 handler (s) for this service...

The command completed successfully

Close the database and check the listener status again. Now there is only one entry in the Command result. The status of the entry is UNKNOWN. Obviously, these two entries correspond to static configurations, the dynamically registered entry automatically disappears with the database being closed.

C: \ Documents ents and Settings \ Administrator> lsnrctl start

LSNRCTL for 32-bit Windows: Version 10.1.0.2.0-Production on 2011 22:14:51

Copyright (c) 1991,200 4, Oracle. All rights reserved.

Starting tnslsnr: please wait...

TNSLSNR for 32-bit Windows: Version 10.1.0.2.0-Production

System parameter file is C: \ oracle \ product \ 10.1.0 \ Db_1 \ network \ admin \ listener. ora

Log messages written to C: \ oracle \ product \ 10.1.0 \ Db_1 \ network \ log \ listener. log

Listening on: (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = 192.168.1.104) (PORT = 1521 )))

Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.104) (PORT = 1521 )))

STATUS of the LISTENER

------------------------

Alias LISTENER

Version TNSLSNR for 32-bit Windows: Version 10.1.0.2.0-Production

Start Date 28-10-2011 21:54:57

Uptime 0 days 0 hr. 0 min. 0 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File C: \ oracle \ product \ 10.1.0 \ Db_1 \ network \ admin \ listener. ora

Listener Log File C: \ oracle \ product \ 10.1.0 \ Db_1 \ network \ log \ listener. log

Listening Endpoints Summary...

(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = 192.168.1.104) (PORT = 1521 )))

Services Summary...

Service "ORCL" has 1 instance (s ).

Instance "ORCL", status UNKNOWN, has 1 handler (s) for this service...

The command completed successfully

This experiment shows the differences between dynamic registration and static configuration: the dynamic registration mechanism does not need to configure the listener, but the result is more accurate than static registration. The static configuration mechanism requires additional configuration for each database, but the results are not accurate.

In addition, dynamic registration also includes the load information of each instance in the RAC environment, which is also the basis for implementing load balancing and failover.

3. LSNRCTL command

Oracle provides a tool called lsnrctl to manage listening processes. We just demonstrated how to view the status. There are three database statuses.

READY: indicates that the instance can accept connection requests;

BLOCKED: The instance currently cannot accept connection requests;

UNKNOWN: This entry is registered through static instead of Dynamic Registration.

The Lsnrctl command can use many parameters. For details, refer to the help Command.

The most common options in daily work include start listener, stop listener, status listener, reload, and reload the listener. ora configuration file. The configuration takes effect immediately without restarting the listener.

QUEUESIZE Parameter

If the listener often receives a large number of connection requests at the same time, you can use this parameter to increase the length of the listener team. The default length is 5. See the example below:

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.2.51) (PORT = 1521) (QUEUESIZE = 20 ))

)

)

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.