Oracle Net Learning (1): Net-8 and listener Behavior Analysis

Source: Internet
Author: User

Environment:

14:56:24 sys@ORCL (^ω^) select * from v$version where rownum=1;BANNER--------------------------------------------------------------------------------Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod

Oracle Net covers various aspects, including the server, customer service, and firewall, and is built on the basis of OS net. Oracle Net can establish a connection between the client or application server and the database server, and is responsible for connection maintenance and data transmission. The client and server must use the same protocol. The most popular protocol is TCP/IP.

 

1 Oracle Network Architecture

Oracle's network architecture is based on the OSI Layer-7 Model

The OCI of the client and the OPI of the server form a Session Layer to establish a complete SQL session between the client and the server. The functions include:

(I) Parse SQL statements for syntax analysis
(Ii) apply for and allocate cursor for SQL statements
(Iii) bind variables to SQL
(Iv) retrieve record metadata from the server data dictionary
(V) Execute SQL
(6) returned results
(Vii) Disable cursor

The TTC layer corresponds to the OSI presentation layer and is responsible for converting character sets and data types between clients and servers.

Net8, which is called 8, is essentially because it is independent of any OSI Layer. configuring the Oracle network connectivity capability is actually configuring the net8 layer, and the net8 layer includes two parts, server listener and client TNS.

 

2 listener

 

On the server side, Oracle Net contains an active process called a listener. When the listener is alive, it only transmits user requests. The listener must exist on the server. It is an intermediate component between the client and the server. The listener is only responsible for establishing connections between the client and the server, and does not communicate between the client and the server. After the listener is started, it reads the Listener Configuration File listener. ora. Located under $ ORACLE_HOME/Network/admin. Run the LSNRCTL command to configure the listener attributes. The OS command tnsping can only determine whether the connection from the client to the listener is smooth and does not affect the normal operation of the server. The client process reads tnsnames. ora requests to establish a connection with the server. If a dedicated server is connected, the listener process creates a server for the client.
Process (created through fork ).

 

Three processes are involved: service process, listening process, and customer process. The working principle is as follows:

① The server starts the listening process, which listens to user requests on a fixed IP address and port.
② The user process sends a connection request to the specified IP address and port and delivers the request to the listener process
③ After the listening process receives a user request, it will fork () A service process
④ The listening process forwards user requests to the service process. At this time, the mission of the listening process ends. If you do not participate in any subsequent work, go back and continue listening for requests from other users.
⑤ After the service process establishes a connection with the user process, it starts to process and return user requests until the user process ends the connection.

Like Oracle Net, the listening process is like Le Jia and Meng Fei. The service process and the customer process are like men and women. After the two parties hold hands, the tasks will not be Le Jia and Meng Fei.

[oracle@localhost ~]$ lsnrctl LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 11-SEP-2012 09:57:03Copyright (c) 1991, 2005, Oracle.  All rights reserved.Welcome to LSNRCTL, type "help" for information.LSNRCTL> helpThe following operations are availableAn asterisk (*) denotes a modifier or extended command:start               stop                status              services            version             reload              save_config         trace               spawn               change_password     quit                exit                set*                show*               

Reload: Reload listener. ora to make the configuration take effect without restarting the listener.
Listener instance status information:
Ready: indicates that the instance can be connected.
Blocked: indicates that the instance cannot be connected.
Ready/secondary: indicates that the second instance of RAC is ready to accept the connection.
Unknown: indicates that the listener is registered statically.

3. Static configuration and Dynamic Registration

Server listeners and databases are independent components. The listening process is not bound to a specific database. If you want to transmit user requests, you must first know how to find the target database. There are two ways to obtain this information: static configuration and dynamic registration.

Static configuration: explicitly tells the listener the information of a Database. The Listener loads this information during startup. This part of information is also recorded in listener. ora, where sid_list _ <listener_name> is the static configuration content.
Dynamic Registration: as long as the database is running, pmon automatically and periodically registers and updates information to the listener process. DBA can also use: Alter system register. Force pmon to register with the listener process. If SERVICE_NAME is not defined, pmon registers the listener process with global db_name. if the listener has a default name, port, and Protocol, Oracle can perform dynamic configuration without any special configuration. If the listener has a non-standard configuration, you need to set the local_listener parameter. You can use alter system set service_names to set one or more service names.

Differences:

1) The static configuration status is unknown and the dynamic registration status is ready.
2) The Listener does not need to be configured for dynamic registration. The static configuration requires additional configuration for each database.
3) Dynamic Registration. Because the listener knows the instance status exactly, it can achieve failover during connection and connect to Server Load balancer during running. For static configuration, the instance is transparent to the listener.

 

4. Client Configuration

To connect the client to the database, you must obtain the following information:

① IP address and port of the server where the database is located
② Database SERVICE_NAME

These two parts are called "connection Descriptors ".

To enhance user experience, Oracle proposes a "connection identifier", also called a network service name. Configure on the server.

No matter which method is used to connect to the database, the connection descriptor is used. However, if a connection identifier is used, the client must have a place to store the relationship between the connection identifier and the connection descriptor.

Oracle provides four methods:

① Local naming: Use tnsnames. ora to complete the translation process
② Easy connect naming: the client does not require any configuration and is only supported by ora 10 Gb.
③ External naming
④ Directory naming

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.