Thursday, June 20, 2019

How Database Connections are Created When Using SCANs

Based on the environment, the following actions occur when you use a SCAN to connect to an Oracle RAC database using a service name.
The numbered actions correspond to the arrows shown in Load Balancing Actions for Oracle RAC Connections That Use SCAN:
  1. The LREG process of each instance registers the database services with the default listener on the local node and with each SCAN listener, which is specified by the REMOTE_LISTENER database parameter. The listeners are dynamically updated on the amount of work being handled by the instances and dispatchers.
  2. The client issues a database connection request using a connect descriptor of the form:
orausr/@scan_name:1521/webapp

  1. Note:
    If you use the Easy Connect naming method, then ensure that the sqlnet.ora file on the client contains EZCONNECT in the list of naming methods specified by the NAMES.DIRECTORY_PATH parameter.
  2. The client uses DNS to resolve scan_name. After DNS returns the three addresses assigned to the SCAN, the client sends a connect request to the first IP address. If the connect request fails, then the client attempts to connect using the next IP address.
  3. When the connect request is successful, the client connects to a SCAN listener for the cluster that hosts the sales database and has an instance offering the webapp service, which in this example is sales1 and sales2. The SCAN listener compares the workload of the instances sales1 and sales2 and the workload of the nodes on which they run. If the SCAN listener determines that node2 is less loaded than node1, then the SCAN listener selects node2 and sends the address for the local listener on that node back to the client.
  4. The client connects to the local listener on node2. The local listener starts a dedicated server process for the connection to the database.
  5. The client connects directly to the dedicated server process on node2 and accesses the sales2 database instance.
Figure Load Balancing Actions for Oracle RAC Connections That Use SCAN


1. Public IP- Public IP is used for Direct connection to a particular instance only.
2. VIP- it's used for transferring the connection to another VIP in case of any failure.
3. Scan IP- its a new concept from 11g R2 onwards, wherein it has pre-information of which node has how much of load and it balances the connection between multiple instances.
     Scan IP max cab be 3 (and Oracle has tested it and as per there internal result, 3 is more than           enough for N instances.)

Remote_listener will have your SCAN_IP.
The local listener will have your VIP of a particular node.
VIP will do failover for your existing connection and incoming new request for that IP
SCAN IP will have re-information about load and will redirect your request to respective less load VIP
if you avoid VIP then you are left with public IP i.e your network card assigned to your server. That public IP is not able to failover in case of any failure.
Private IP, it's only for internal communication of RAC components maintained and managed by Oracle software itself

Reference- docs.oracle.com

No comments:

Post a Comment