All technological notes.
Oracle Net Services
TCP/IP, HTTP, FTP, and WebDAV.Communication protocols
Oracle Net
Oracle Net acts as the data courier for both the client application and the database server, exchanging messages between them.It can perform these jobs because it is located on each computer that needs to talk to the database server. 包括客户端
Oracle Net is a background component for application connections to the database.Oracle Net includes an active process called Oracle Net Listener, which is responsible for coordinating connections between the database and external applications.Oracle Net Listener / the listener
When a client requests a network session with a database, Oracle Net Listener (typically called the listener) receives the request.
A single listener can service multiple database instances and thousands of client connections
Tools to configure the listener and specify log file locations
Enterprise Manager Cloud Control or Oracle Net Manager.During an Oracle Database installation, Oracle Universal Installer launches Oracle Net Configuration Assistant and creates a local listener named LISTENER.
LISTENER is automatically populated with available database services through a feature
called dynamic service registration.LISTENER listens on the following TCP/IP protocol address:
ADDRESS=(PROTOCOL=tcp)(HOST=host_name)(PORT=1521)
TCP/IP and a port number of 1521 is assumed.To make a client or middle-tier connection, Oracle Net requires the client to know the:
address or host where the listener residesprotocol that the listener acceptsSERVICE_NAMESOracle Net names resolution
SERVICE_NAMESAn Oracle database is represented to a client as a service.
Databases are identified by a service name that is specified by the SERVICE_NAMES parameter in the initialization parameter file.
DB_NAME parameter value) and the domain name (DB_DOMAIN parameter value).DB_NAME + DB_DOMAINconnect descriptor
connect descriptor that provides the location of the database and the name of the database service.Example:
# connect descriptor
# enables clients to connect to a database service called finance.us.flowers.com
finflowers = # net service name
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=flowers-server)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=finance.us.flowers.com))
)
Users can initiate a connection request to the Oracle database by sending a connect string.
connect string
A connect identifier can be
connect descriptor itselfName Resolution, a name that resolves to a connect descriptor.connect identifiers is a net service name, which is a simple name for a service.When a net service name is used, connection processing takes place by mapping the net service name to a connect descriptor.
Name Resolution = the method to map net service name to connect descriptor.
# Using connect string
# provide username, password, and a net service name(finflowers)
CONNECT jsmith/jspass@finflowers
# A connect descriptor
# provide protocol, host/address, port, service name
finflowers =(
DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=flowers-server)(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=finance.us.flowers.com)
)
)
name resolution » listener » validate service name » spawn server process » lsnr pass initialization info server_pro » server_pro authenticate credentials » create user process
After Oracle Net names resolution is complete, a connection request is passed from the user or middle-tier application (hereafter referred to as the user process) to the listener.
The listener receives a CONNECT packet and checks whether that CONNECT packet is requesting a valid Oracle Net service name.
service name is not requested (as in the case of a tnsping request), the listener acknowledges the connect request and does nothing else.service name is requested, the listener transmits an error code to the user process.service name, the listener spawns a new process, server process , to deal with the connection.The listener connects to the process and passes the initialization information, including the address information for the user process.
server process.The server process checks the user’s authentication credentials (usually a password), and if the credentials are valid, a user session is created.
Dedicated server process:
server process now acts as the user’s agent on the server.server process is responsible for:
database buffer cache for data blocks required to perform SQL statementsdatabase buffer cache portion of the System Global Area (SGA), if the blocks are not already present in the SGASort Area is a memory area that is used to work with sorting; it is contained in a portion of memory that is associated with the Program Global Area (PGA).Dynamic Service Registration
PDB service
Dynamic service registration registers all PDB services to the same listener.Benefits
Real Application Clusters and Oracle Data GuardConfiguration of dynamic service registration:
INSTANCE_NAME , LOCAL_LISTENER, REMOTE_LISTENER, and SERVICE_NAMES initialization parameters are properly configured.tnsnames.ora file.The Role of the LREG Process
The LREG process polls the listeners to see if they’re running and, if so, registers database service information to them:
instance nameservice names available on the database instance (for example, ORCL.example.com and PDB1.example.com)database instanceService handlers (dispatchers and dedicated servers) available to the database instanceLREG registers with the listeners after the database instance mounts the database and every 60 seconds afterward
Static service registration
Advantages of Static Service Registration
static listener (which can point to a database service that is down) and a dynamic listener entry (which shows nonexistence) when the database instance is shut down.
With static registration, the listener has no knowledge of whether its database services exist or not.
UNKNOWN.You can have both static listeners and dynamic listeners configured at the same time.
General steps to configure static service registration:
listener.ora, define a listener and its protocol addresses.listener.ora, also create a SID_LIST_<listener name> section that lists the database services for the listener.Required Use of Static Service Registration:
Naming Methods
Easy connect naming:
Easy Connect connection strings:
<username>/<password>@<hostname>:<listener port>/<service name>Example:
# SERVICE_NAMES=db
# DB_DOMAIN=us.oracle.com
connect hr/hr@db.us.oracle.com
Local naming:
connect descriptors (identified by their net service name) in a local configuration file named tnsnames.ora on the client. 客户端One advantage of local naming is that the database users need to remember only a short alias rather than the long connect string required by Easy Connect.
The local list of known services is stored in the following text configuration file:
<oracle_home>/network/admin/tnsnames.oraTNS_ADMIN environment variable.Supports advanced connection options such as:
Example:
CONNECT hr/hr@orcl
Directory naming:
Directory Access Protocol (LDAP).Requires LDAP with Oracle Net names resolution information loaded:
advantage of directory naming:
tnsnames.ora files containing the changed service name information before users can connect to new or modified services.Directory naming is appropriate for organizations in which Oracle Net service configurations change frequently
| Component | Description | File |
|---|---|---|
Listeners |
A process to listen for incoming client connection requests and manage traffic to the server. | listener.ora |
| Naming methods | A resolution method to resolve a connect identifier to a connect descriptor | |
Naming (net service name) |
A simple name (connect identifier) to resolve a connect descriptor . | tnsnames.ora (local configuration) |
| Profiles | Parameters that specifies preferences for enabling and configuring Oracle Net features. | sqlnet.ora |