Understanding SQL*Net
How SQL*Net Establishes Connections to a Multi-Threaded Server
The multi-threaded server enables many clients to connect to the same server without the need for dedicated server processes for each client. Using the multi-threaded server enables you to minimize the memory and processing resources needed on the server side as the number of connections to the database increases.
The sequence of events that occurs with the Oracle7 multi-threaded server is as follows:
- The listener and the multi-threaded server start up.
- Clients connect to the Oracle7 multi-threaded server.
What Happens When an MTS and Listener Are Started
During initial startup of the Oracle7 multi-threaded server and the listener, the following sequence occurs:
2. The DBA starts the Oracle7 database. Dispatchers start according to the configuration parameters in the initialization parameter file. Dispatchers each use one particular protocol. There may be many, on assorted protocols. Each dispatcher performs a wildcard listen for the protocol assigned to it.
Note: A wildcard listen is where the server process listens, but informs the underlying protocol stack (or operating system in the case of the IPC Protocol Adapter) that it has no preference as to what address it listens for other than specifying the protocol on which it wishes to perform the operation. As a result, many operating systems will choose a free listening address and automatically assign this to the requesting server process.
Note: If step 2 is performed before step 1, the dispatchers will be unable to contact the listener in step 3. If this occurs, each dispatcher loops and attempts to reconnect to the listener every 60 seconds. Meanwhile, incoming connection requests will be handled through other means (prespawned dedicated or newly spawned dedicated server processes).
The listener and the Oracle7 multi-threaded server should be ready for incoming connections at this point. You can check which dispatchers have registered with the listener by typing
lsnrctl services listener_name
How a Multi-Threaded Server Connection Request Is Handled
The following is how a multi-threaded server connection request is handled:
1. The client calls the address of the listener for the desired database. If there is more than one listener, the client randomizes its calls among them.
2. The listener receives the connection request, performs the connection handshake and determines if the client is allowed to connect (by checking the list of SIDs it listens for), at which point it continues with step 6. If not, the listener refuses the connection and then resumes at step 6.
3. The listener issues a redirect message back to the client containing the address of the least-called dispatcher that is listening on the protocol used by the client.
4. The client closes the connection to the listener and then establishes a new connection to the dispatcher, using the address provided by the listener in the redirect message.
5. The listener and dispatcher perform a short handshake to update each other of the presence of a new connection. This is so that the listener can load balance connections between dispatchers running on the same protocol.
6. The listener resumes listening for incoming connections.
When an Oracle7 Server has been configured as a multi-threaded server, incoming connections are always routed to the dispatcher unless the connection request specifically requests a dedicated server (by having SERVER=DEDICATED in the CONNECT_DATA portion of the connect descriptor) or no dispatchers are available. To create this parameter, create an alias for the database using Network Manager. (An alias is an alternative name that is mapped to a service name.) Use Network Manager to make that alias a dedicated server. See Chapter 5 in the Oracle Network Manager Administrator's Guide for more information.