|Oracle9i Net Services Administrator's Guide
Release 2 (9.2)
Part Number A96580-01
This chapter explains how databases are identified and how clients access them.
This chapter contains these topics:
Chapter 1, "Networking Challenges in the Internet Age" for an introductory level overview of networking concepts
This section contains these topics:
An Oracle database is represented to clients as a service; that is, the database performs work on behalf of clients. A database can have one or more services associated with it.
Figure 2-1 shows two databases, each with its own database service for intranet clients. One service,
sales.us.acme.com, enables salespersons to access the sales database. Another service,
finance.us.acme.com, enables financial analysts to access the finance database.
The sales and finance databases are identified by service names,
finance.us.acme.com in this example. The service name is specified by the
SERVICE_NAMES parameter in the initialization parameter file. The service name defaults to the global database name, a name comprising the database name (
DB_NAME parameter) and domain name (
DB_DOMAIN parameter). In the case of
sales is the database name and
us.acme.com is the domain name.
You can change the value of
A database can have multiple services associated with it. Figure 2-2 shows one database that has two different services for Web clients. One service,
book.us.acme.com, is dedicated to clients making book purchases. The other service,
soft.us.acme.com, is dedicated to clients making software purchases.
Having multiple services associated with one database enables the following functionality:
A database has one or more instances. An instance is comprised of a memory area called the System Global Area (SGA) and Oracle processes. The memory and processes of an instance efficiently manage the associated database's data and serve the database users.
An instance also manages other services, such as Oracle XML DB.
Figure 2-3 shows two instances,
finance, associated with their respective databases.
Like services, instances are identified by an instance name,
finance in this example. The instance name is specified by the
INSTANCE_NAME parameter in the initialization parameter file. The instance name defaults to the Oracle System Identifier (SID) of the instance.
Some hardware architectures allow multiple computers to share access to data, software, or peripheral devices. Oracle9i Real Application Clusters can take advantage of such architecture by running multiple instances on different computers that share a single physical database.
Figure 2-4 shows an Oracle9i Real Application Clusters configuration. In this example, two instances,
sales2, are associated with one database service,
To connect to a database service, clients use a connect descriptor that provides the location of the database and the name of the database service. The following example shows a connect descriptor that enables clients to connect to a database service called
(ADDRESS=(PROTOCOL=tcp)(HOST=sales-server)(PORT=1521)) (CONNECT_DATA= (SERVICE_NAME=sales.us.acme.com)))
The address portion of the connect descriptor is actually the protocol address of the listener. To connect to a database service, clients first contact a listener process that typically resides on the database server. The listener receives incoming client connection requests and hands these requests to the database server. Once the connection is established, the client and database server communicate directly.
Much like a business address, the listener is configured to accept requests from clients at a protocol address. This address defines the protocol the listener is listening on and any other protocol specific information. For example, the listener could be configured to listen at the following protocol address:
This example shows a TCP/IP protocol address that specifies the host of the listener and a port number. Clients configured with this same protocol address can send connection requests to this listener.
The connect descriptor also specifies the database service name with which clients seek to establish a connection. The listener knows which services for which it can handle connection requests, because an Oracle database dynamically registers this information with the listener. This process of registration is called service registration. It also provides the listener with information about the database instances and the service handlers available for each instance. Service handlers act as connection points to an Oracle database server. A service handler can be a dispatcher or a dedicated server.
If connecting to a specific instance of the database is required, clients can also specify the
INSTANCE_NAME of a particular instance in the connect descriptor. This feature can be useful if you have an Oracle9i Real Application Clusters configuration. For example, the following connect descriptor specifies an instance name of
sales1 that is associated with
(ADDRESS=(PROTOCOL=tcp)(HOST=sales-server)(PORT=1521)) (CONNECT_DATA= (SERVICE_NAME=sales.us.acme.com) (INSTANCE_NAME=sales1)))
Alternatively, clients that always want to use a particular service handler type can use a connect descriptor that specifies the service handler type. In the following example, a connect descriptor is configured to use a dispatcher for a shared server configuration, as indicated by
(ADDRESS=(PROTOCOL=tcp)(HOST=sales-server)(PORT=1521)) (CONNECT_DATA= (SERVICE_NAME=sales.us.acme.com) (SERVER=shared)))
If you want the client to use a dedicated server, you can specify
(SERVER=dedicated) in place of
(SERVER=shared). If the
SERVER parameter is not set, then shared server configuration is assumed. However, the client will use a dedicated server if no dispatchers are available.
When the listener receives the client request, it selects one of the service handlers that were previously registered. Depending on the type of handler selected, the communication protocol used, and the operating system of the database server, the listener performs one of the following actions:
Once the listener has completed the connection operation for the client, the client communicates with the Oracle database server without the listener's involvement. The listener resumes listening for incoming network sessions.
For some configurations, such as Oracle9i Real Application Clusters, multiple listeners on multiple nodes can be configured to handle client connection requests for the same database service. In the following example,
sales.us.acme.com can connect to
sales.us.acme.com using listeners on either
(DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=tcp)(HOST=sales1-server)(PORT=1521)) (ADDRESS=(PROTOCOL=tcp)(HOST=sales2-server)(PORT=1521))) (CONNECT_DATA= (SERVICE_NAME=sales.us.acme.com)))
A multiple-listener configuration also enables you to leverage the following failover and load balancing features:
These features can be implemented either singly or in combination with each other.
The connect-time failover enables clients to connect to another listener if the initial connection to the first listener fails. The number of listener protocol addresses determines how many listeners are tried. Without connect-time failover, Oracle Net attempts a connection with only one listener.
The Transparent Application Failover (TAF) feature is a runtime failover for high-availability environments, such as Oracle9i Real Application Clusters and Oracle9i Real Application Clusters Guard. TAF fails over and reestablishes application-to-service connections. It enables client applications to automatically reconnect to the database if the connection fails and, optionally, resume a
SELECT statement that was in progress. The reconnection happens automatically from within the Oracle Call Interface (OCI) library.
The client load balancing feature enables clients to randomize connection requests among the listeners. Oracle Net progresses through the list of protocol addresses in a random sequence, balancing the load on the various listeners. Without client load balancing, Oracle Net progresses through the list of protocol addresses sequentially until one succeeds.
The connection load balancing feature improves connection performance by balancing the number of active connections among multiple dispatchers. In a single-instance environment, the listener selects the least loaded dispatcher to handle the incoming client requests. In an Oracle9i Real Application Clusters environment, connection load balancing also has the capability to balance the number of active connections among multiple instances.
Due to dynamic service registration, a listener is always aware of all instances and dispatchers regardless of their location. Depending on the load information, a listener decides which instance and, if shared server is configured, which dispatcher to send the incoming client request to.
In a shared server configuration, a listener selects a dispatcher in the following order:
In a dedicated server configuration, a listener selects an instance in the following order:
If a database service has multiple instances on multiple nodes, the listener chooses the least loaded instance on the least loaded node. If shared server is configured, then the least loaded dispatcher of the selected instance is chosen.
This section contains these topics:
The shared server architecture uses a dispatcher process to direct client connections to a common request queue. An idle shared server process from a shared pool of server processes picks up a request from the common queue. This approach enables a small pool of server processes to serve a large number of clients. A significant advantage of the shared server model over the dedicated server model is reduced system resources, enabling support of an increased number of users.
The listener uses the dispatcher as a type of service handler to which it can direct client requests. When client a client request arrives, the listener performs one of the following actions:
The listener uses direct hand off whenever possible. Redirect messages are used, for example, when dispatchers are remote to the listener.
Figure 2-5 shows the listener handing a connection request directly off to a dispatcher.
Figure 2-6 shows the role of a dispatcher in a redirected connection.
In a dedicated server configuration, the listener starts a separate dedicated server process for each incoming client connection request dedicated to servicing the client. Once the session is complete, the dedicated server process terminates. Because a dedicated server process has to be started for each connection, this configuration may require more system resources than shared server configurations.
A dedicated server process is a type of service handler that the listener starts when it receives a client request. To complete a client/server connection establishment, one of the following actions occurs:
If the client and database server exist on the same computer, a client connection can be passed directly to a dedicated server process without going through the listener. The application initiating the session spawns a dedicated server process for the connection request. This happens automatically if the application that is used to start the database is on the same computer as the database.
In order for remote clients to connect to dedicated servers, the listener and the database instance must be running on the same computer.
Figure 2-7 shows the listener passing a client connection request to a dedicated server process.
Figure 2-8 shows the role of a dedicated server in a redirected connection.
Users initiate a connection request by providing a connect string. A connect string includes a username and password, along with a connect identifier. A connect identifier can be the connect descriptor itself or a name that resolves to a connect descriptor. One of the most common connect identifiers is a net service name, a simple name for a service. The following examples demonstrate one connect string that uses a complete connect descriptor as the connect identifier and another connect string that uses net service name
sales as the connect identifier.
CONNECT scott/tiger@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=sales-server1)(PORT=1521)) (CONNECT_DATA=(SERVICE_NAME=sales.us.acme.com))) CONNECT scott/tiger@sales
When net service name
sales is used, connection processing takes place by first mapping
sales to the connect descriptor. This mapped information is stored in one or more repositories of information that are accessed with naming methods.
The process for establishing a client session with the aid of a naming method is as follows:
Oracle Net provides support for following naming methods:
The local naming method stores net service names and their connect descriptors in a localized configuration file named
Oracle Names uses Oracle proprietary software to store the names and addresses of all database services on a network. Clients wishing to connect to a database server direct their connect requests to an Oracle Names server. Oracle Names servers resolve the name to a network address and return that information to the client.
In future releases, Oracle Names will not be supported as a centralized naming method. Because no new enhancements are being added to Oracle Names, consider using directory naming instead or migrating an existing Oracle Names configuration to directory naming, as described in Chapter 10, "Exporting Naming Data to a Directory Server".
The host naming method enables users to connect to an Oracle database server by using a host name alias. Host names are mapped to the database server's global database name in an existing names resolution service, such as Domain Name System (DNS), Network Information Service (NIS), or a centrally maintained set of
The external naming method stores net service names in a supported non-Oracle naming service. These supported third-party services include: