Home » Oracle » Oracle Database » Virtual IP Addresses : VIP in Oracle RAC

Virtual IP Addresses : VIP in Oracle RAC

What is VIP in Oracle RAC?
High Availability (HA) databases are less than satisfactory if database clients are unable to connect or reconnect quickly when planned or unplanned downtime causes one or more instances to become unavailable. Database clients use TNS descriptors to contact a TNS listener on one of the cluster nodes from a list of listeners on all cluster nodes. TNS descriptors for RAC contain hostnames or IP addresses of the public network interfaces on all cluster nodes.

 

When database clients attempt connections to cluster databases one of the available hostnames in the TNS descriptor is selected and a connection request is made. If the selected instance or listener on that host is unavailable, clients select another hostname and try again until they succeed in connecting.

Although this technique improves availability when instances or listeners are down, a network timeout is required for clients to detect unavailable nodes. Clients are therefore delayed by the TCP timeout period before attempting to connect to another hostname resulting in slower network connection establishment and lower availability of connections. To circumvent these network timeouts Oracle Database 10g clusters and above uses Virtual IP addresses or VIPs, which respond to connection requests made over the public network interfaces in one of two ways. While a cluster node is available its associated VIP is active on that node, and inbound connection requests are accepted by the listener. If a node becomes unavailable its associated VIP is activated on one of the remaining cluster nodes by the Clusterware thereby enabling this other node to reject connection requests originally sent to the failed node. This rejection of connection requests on foreign VIPs results in immediate notification to requesting clients, which immediately select another hostname from the TNS descriptor. This results in faster network connection establishment and higher availability of connections.

See also  RANK, DENSE_RANK and ROW_NUMBER functions in Oracle

The below picture describes the working of the VIP before and after Failover of the Oracle RAC nodes

VIP in Oracle RAC

How Oracle VIP are managed

Oracle Clusterware manages VIPs as a node application. When Oracle Clusterware discovers that a node has failed, it will relocate the VIP to one of the remaining nodes. A promiscuous ARP packet is broadcast to inform clients that the MAC address for the VIP has changed.
The relocated VIP does not forward incoming connections to the listener; instead it immediately sends back a failure message to the client. The client can then immediately failover to an alternate address. In the above slide, node 1 has crashed. Oracle Clusterware relocates VIP1 to node2. When the client attempts to connect using VIP1 it receives an error message; when it attempts to connect using VIP2 the connection is forwarded to the listener

Applications that connect to Oracle database in Oracle Clusterware  should connect using the VIP address and not the public IP address
The VIP address maps to the MAC address of the adapter. It is possible to use Oracle VIPs with bonded/teamed NICs.

Commands related to VIP in Oracle RAC

How to start/stop GSD, VIP, listener and ONS
#srvctl start nodeapps -n node_name
#srvctl start nodeapps -n techgo

#srvctl stop nodeapps -n node_name
#srvctl stop nodeapps -n techgo

How to find the configuration for the nodeapps

#srvctl config nodeapps -n node_name [-a] [-g] [-o] [-s] [-l]
-a
#srvctl config nodeapps -n techgo -a

How to modify the Configuration of the VIP

#srvctl modify nodeapps -n node_name [-A new_vip_address]
#srvctl modify nodeapps -n techgo -A 101.80.11.23/255.255.252.0/eth0

See also  Top 46 Oracle ASM Interview Questions

More option can be specified as below

srvctl modify nodeapps [-n node_name -A new_vip_address] [-S subnet/netmask[/if1[|if2|…]] [-m multicast_ip_address] [-p multicast_port_number] [-e eons_listen_port] [-l ons_local_port] [-r ons_remote_port] [-t host[:port][,host:port,…]] [-v]
How to add vip
srvctl add vip -n node_name -A {name|ip}/netmask[/if5[if2|…]] [-k network_number] [-v]
#srvctl add vip -n node96 -A 101.80.11.23/255.255.255.0 -k 2

How to remove the VIP

srvctl remove vip -i “vip_name_list” [-f] [-y] [-v]

How to start/stop/status the VIP

srvctl start vip {-n node_name|-i vip_name} [-v]

srvctl stop vip {-n node_name|-i vip_name} [-r] [-v]

srvctl status vip {-n node_name|-i vip_name}

How to enable/disable/config
srvctl enable vip -i vip_name [-v]

srvctl disable vip -i vip_name [-v]

srvctl config vip {-n node_name|-i vip_name}

Some time VIP may not failback to Original Node,Then we can use below command to failback

Failover VIP (on the destination node)
./crs_relocate [vip resource name]

The VIP will now go where it’s configured to be

Client tnsnames configuration before and after VIP in Oracle RAC

Client TNS Before VIP

<TNS DESCRIPTOR> =
(DESCRIPTION =
(ADDRESS=(PROTOCOL=TCP)(HOST=racnode1)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=racnode2)(PORT=1521))
(CONNECT_DATA =
(SERVICE_NAME = Service)
)
)

Client TNS AFTER VIP
<TNS DESCRIPTOR> =
(DESCRIPTION =
(ADDRESS=(PROTOCOL=TCP)(HOST=racnode1-vip)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=racnode2-vip)(PORT=1521))
(CONNECT_DATA =
(SERVICE_NAME = Service)
)
)

In Database Management Software Oracle 11g R2, One more concept is introduced Single Client Access Name (SCAN). Whole Real Application Cluster has given a name called SCAN name. This is basically a name corresponds to minimum one or recommended three IP’s. These IP’s are called SCAN VIP’s.

Read below link for detailed information about SCAN

Single Client Access Name (SCAN)

Related Articles on oracle RAC

How Oracle RAC handles instance failure and recovery

See also  Weblogic : Sun JDK and Oracle Jrocket

What is Oracle Clusterware?

How to add any node to Oracle RAC cluster in 10g and 11g

How to setup diag wait in cluster

What is voting disks in RAC

FAQ  for VIP in Oracle RAC

1) What is a virtual IP address or VIP?
A virtual IP address or VIP is an alternate IP address that the client connections use instead of the standard public IP address. To configure VIP address, we need to reserve a spare IP address for each node, and the IP addresses must use the same subnet as the public network.
2) What is the use of VIP?
If a node fails, then the node’s VIP address fails over to another node on which the VIP address can accept TCP connections but it cannot accept Oracle connections.
3) Give situations under which VIP address failover happens:-
VIP addresses failover happens when the node on which the VIP address runs fails, all interfaces for the VIP address fails, all interfaces for the VIP address are disconnected from the network.
4) What is the significance of VIP address failover?
When a VIP address failover happens, Clients that attempt to connect to the VIP address receive a rapid connection refused error .They don’t have to wait for TCP connection timeout messages.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top