Connection load balancing is another interesting tool for spreading your connection load out more evenly. This concept is usually implemented for Oracle Parallel Servers, so we will discuss an Oracle Parallel Servers example in this lesson. The advantage of connection load balancing is that you can allow your network service (Network Services) to redirect connections to a database server that is less busy, even if that database server is on a different machine. The load balancing cycles through each dispatcher in the service and connects with the least busy dispatcher. In the case of Oracle Parallel Servers, it can be set up to cycle through all the dispatchers in other nodes in the Oracle Parallel Service, even if they are on a remote site's database.
Configuring Database Server
The following initialization parameters must be set for the database server to support load balancing:
SERVICE_NAMES for the database service name. This name will be shared among multiple database instances that are involved in load balancing.
INSTANCE_NAME for the current instance name
Configuring RMAN for Use with Shared Server in Oracle 11g R2
RMAN cannot connect to a target database through a shared server dispatcher. RMAN requires a dedicated server process. If your target database is configured for a shared server, then you must modify your Oracle Net configuration to provide dedicated server processes for RMAN connections. To ensure that RMAN does not connect to a dispatcher when a target database is configured for a shared server, the net service name used by RMAN must include (SERVER=DEDICATED) in the CONNECT_DATA attribute of the connect string. Oracle Net configuration varies greatly from system to system. The following procedure illustrates only one method. This scenario assumes that the following service name in tnsnames.ora file connects to a target database using the shared server architecture, where inst1 is a value of the SERVICE_NAMES initialization parameter:
2. Start SQL*Plus and then connect using both the shared server and dedicated server service names to confirm the mode of each session. For example, connect with SYSDBA privileges to inst1_ded and then execute the following SELECT statement (sample output included):
SQL> SELECT SERVER
2 FROM V$SESSION
3 WHERE SID = (SELECT DISTINCT SID FROM V$MYSTAT);
SERVER
---------
DEDICATED
1 row selected.
To connect to a shared server session, you connect with SYSDBA privileges to inst1_shs and then execute the following SELECT statement (sample output included):
SQL> SELECT SERVER
2 FROM V$SESSION
3 WHERE SID = (SELECT DISTINCT SID FROM V$MYSTAT);
SERVER
---------
SHARED
1 row selected.
3. Start RMAN and connect to the target database using the dedicated service name.
Optionally, connect to a recovery catalog. For example, enter:
Each node's listener must contain the addresses of all the nodes that are to be shared in the connection load balancing. Here is an example of the listener.ora file[1] configured so that two nodes participate in the connection load balancing.
Configuring Net
When configuring Oracle Network Services for connection load balancing[2], you must work with the tnsnames.ora file. You can configure by directly editing the file, or you can use the Network Services Configuration Assistant. Due to some inconsistencies in the Network Services Configuration Assistant, we will continue to work directly with the tnsnames.ora file as we have throughout this module. Look at the MouseOver here to see an example of the listener.ora file.
tnsnames.ora configuration file entry named PETS_USA. This configuration defines connection parameters for Oracle Net Services and demonstrates connection load balancing and failover features.
Breakdown and Analysis:
List the other components that must be configured and the parameters you must use to complete the connection load balancing for the example in the simulation.
Answer 1: The database itself must be started up with these parameters in place: SERVICE_NAMES
(set to a common name for all nodes); INSTANCE_NAME (a unique name for each instance); and MTS_DISPATCHERS (to configure the dispatchers for the database instance). Also, the listener for the database must be configured with an address entry for all of the nodes that are to share load balancing.
Why does load balancing make sense for a distributed set of servers that connects its nodes via the Internet?
Answer 2:Connection load balancing would help in two important ways. First, because the Internet can sometimes lose service to certain geographic areas, a node in the area that lost service can be supported by the databases
in other geobraphic areas that did not lose service. Second, the database load would be distributed to all the nodes evenly, regardless of which node first received the connection request, so no single node becomes overloaded.
The next lesson covers automatic instance registration.
[1]listener.ora file: The listener.ora file is a configuration file within Oracle Network Services that defines the parameters of an Oracle Net Listener. Specifically, it specifies the network protocols and addresses that the listener uses to receive connection requests from client applications, and also the database services that the listener is to monitor.
[2]Connection load balancing: A feature of Network Services that reviews the load on each of a group of database services or database dispatchers, and then selects the least busy available service or dispatcher and assigns a new connection to it.