July 15, 2012

Virtual IP (VIP) in RAC

What is (use of) Virtual IP (VIP) in Oracle Real Application Clusters (RAC)?

When installing Oracle 10g/11g R1 RAC, three network interfaces(IPs) are required for each node in the RAC cluster, they are:



  • Public Interface:  Used for normal network communications to the node
  • Private Interface:  Used as the cluster interconnect
  • Virtual (Public) Interface: Used for failover and RAC management

When installing Oracle 11g R2 RAC, we need one more network interface(IP) is required for each node in the RAC cluster.



  • SCAN Interface (IP):  Single Client Access Name (SCAN) is a new Oracle Real Application Clusters (RAC) 11g Release 2 feature, that provides a single name for clients to access an Oracle Database running in a cluster. The benefit is clients using SCAN do not need to change if you add or remove nodes in the cluster.

When a client connects to a tns-alias, it uses a TCP connection to an IP address, defined in the tnsnames.ora file. When using RAC, we define multiple addresses in our tns-alias, to be able to failover when an IP address, listener or instance is unavailable. TCP timeouts can differ from platform to platform or implementation to implementation. This makes it difficult to predict the failover time. 

Oracle 10g Cluster Ready Services enables databases to use a Virtual IP address to configure the listener ON. This feature is to assure that oracle clients quickly failover when a node fails. In Oracle Database 10g RAC, the use of a virtual IP address to mask the individual IPO addresses of the clustered nodes is required. The virtual IP addresses are used to simplify failover and are automatically managed by CRS.

To create a Virtual IP (VIP) address, the Virtual IP Configuration Assistant (VIPCA) is called from the root.sh script of a RAC install, which then configures the virtual IP addresses for each node specified during the installation process. In order to be able to run VIPCA, there must be unused public IP addresses available for each node that has been configured in the /etc/hosts file.

One public IP address for each node to use for its Virtual IP address for client connections and for connection failover. This IP address is in addition to the operating system managed public host IP address that is already assigned to the node by the operating system. This public Virtual IP must be associated with the same interface name on every node that is a part of the cluster. The IP addresses that are used for all of the nodes that are part of a cluster must be from the same subnet. The host names for the VIP addresses must be registered with the domain name server (DNS). The Virtual IP address should not be in use at the time of the installation because this is a Virtual IP address that Oracle manages internally to the RAC processes. This virtual IP address does not require a separate NIC. The VIPs should be registered in the DNS. The VIP addresses must be on the same subnet as the public host network addresses. Each Virtual IP (VIP) configured requires an unused and resolvable IP address.

Using virtual IP we can save our TCP/IP timeout problem because Oracle notification service (ONS) maintains communication between each nodes and listeners. Once ONS found any listener down or node down, it will notify another nodes and listeners. While new connection is trying to establish connection to failure node or listener, virtual IP of failure node automatically divert to surviving node and session will be establishing in another surviving node. This process doesn't wait for TCP/IP timeout event. Due to this new connection gets faster session establishment to another surviving nodes/listener.
Virtual IP (VIP) is for fast connection establishment in failover dictation. Still we can use physical IP address in Oracle 10g in listener if we have no worry for failover timing. We can change default TCP/IP timeout using operating system utilities/commands and kept smaller. But taking advantage of VIP (Virtual IP address) in Oracle 10g RAC database is advisable.

Commands related to VIP


#srvctl start nodeapps -n node_name   -- Starts GSD, VIP, listener and ONS
#srvctl start nodeapps -n rac99

#srvctl stop nodeapps -n node_name [-r] -- Stops GSD, VIP, listener and ONS

#srvctl stop nodeapps -n lnx03

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

    -a                  Display VIP configuration
#srvctl config nodeapps -n node33 -a

#srvctl modify nodeapps -n node_name [-A new_vip_address]

#srvctl modify nodeapps -n lnx06 -A 10.50.99.43/255.255.252.0/eth0

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]

srvctl modify nodeapps -n node1 -A 100.200.300.40/255.255.255.0/eth0

srvctl add vip -n node_name -A {name|ip}/netmask[/if1[if2|...]] [-k network_number] [-v]

#srvctl add vip -n node96 -A 192.124.16.96/255.255.255.0 -k 2

srvctl remove vip -i "vip_name_list" [-f] [-y] [-v]

srvctl remove vip -i "vip1,vip2,vip3" -f -y -v

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

srvctl start vip -i dev1-vip -v

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

srvctl stop vip -n node1 -v

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

srvctl status vip -i node1-vip

srvctl enable vip -i vip_name [-v]

srvctl enable vip -i prod_vip -v

srvctl disable vip -i vip_name [-v]

srvctl disable vip -i vip3 -v

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

srvctl config vip -n devnode2

srvctl getenv vip -i vip_name [-t "name_list"] [-v]

srvctl getenv vip -i node1-vip

srvctl setenv vip -i vip_name {-t "name=val[,name=val,...]" | -T "name=val"}

srvctl setenv vip -i dev1-vip -t LANG=en

srvctl unsetenv vip -i vip_name -t "name_list" [-v]

srvctl unsetenv vip -i myvip -t CLASSPATH

#olsnodes -i   ==> will show VIPs of the nodes.

node1 168.192.1.1
node2 168.192.2.1
node3 168.192.3.1
node4 168.192.4.1

$vipca   - VIP Configuration Assistant

$vipca -nodelist node1,node3

Other Articles:    crsctl commands RAC      srvctl commands RAC      cluvfy commands RAC    SCAN in RAC