Reference: http://www.luocs.com/archives/281.html
Http://www.oracle.com/technetwork/products/clustering/overview/scan-129069.pdf
These days to do 11g RAC experiment, only to discover the concept of Oracle 11g scan IP, at the time of installation, directly in the host file added a scan corresponding resolution, after the installation succeeded. After the search on the Internet a lot of information, since that scan IP has a certain understanding, just around each person, perhaps the wrong place, please see the people do not hesitate to correct.
Scan is the abbreviation for simple client access name, not the meaning of an English scan. This feature is available in Oracle 11GR2 version. the role of scan
This function is: the server side and the client added a layer of virtual interface, the original client tnsnames in order to achieve load balancing, the need to register multiple node servers at the same time listening to information, so that when the server side to add or delete nodes, The corresponding server side of the TNSNames file to do the appropriate maintenance, such as server-side increase node, to the client's tnsnames to increase the node's listening information, delete the node in the client's tnsnames to delete the node's listening information. This is the implementation of load balancing before 11GR2. the difference between scan and VIP This looks pretty good, but if for a large LAN, the client has hundreds of thousands, and distributed in various places, the original simple thing is not easy. Scan IP is to address this problem, it is in the server and the client to establish a layer of virtual access layer, the client tnsnames only scan IP listening information, that is, the client directly access scan IP without direct access to the real server IP. And the scan IP is floating, it and the node itself is the difference between the VIP is that the VIP listener is tied to the instance, the role of setting up a VIP, when the node down, the VIP will automatically jump to the normal node, but the VIP corresponding listener program does not jump, originally, If it does not apply to the VIP, the original connection to the downtime of the program will not be able to respond to the server, and then wait for the connection time to go out, the client again retry, retry a certain number of times still fail to transfer to other nodes, this process is quite time-consuming. If the use of VIP, node downtime after the VIP jump to the normal node, the original access to downtime node program request to the VIP Jump node, the normal node received a connection request directly to the endpoint returned error message, told it originally visited the node has broken down, This is where the client will use the other addresses in TNS. This time is much smaller than the time that does not apply to the VIP.
and scan IP mechanism is the IP with the corresponding listener floating together, if a node down, then the original stay in the node scan IP and listener will jump to other available nodes. Therefore, for the client, you do not need to change the original configuration information, only need to access the scan IP can normally use the database, as for scan IP and real node of the corresponding relationship, it is scan IP this layer to care and realizeHow to implement scanThere are two ways to implement scan IP, one is DNS, and the other is the GNS (grid naming Service) provided by Oracle itself. Where GNS is for DHCP, that is, the server side of the VIP and scan IP is dynamically assigned, the specific things are not studied, I just looked at the implementation of the DNS method.
Because the host file domain name resolution can not achieve a domain name and multiple IP corresponding, if in the host file has a domain name corresponding to a number of different IP resolution line, then in the domain name resolution will only be the first line of action. But the DNS server can realize a domain name and multiple IP correspondence. And the DNS server uses the Round-robin (round-robin) algorithm for scheduling between multiple IPs.
For example, the domain name and IP corresponds to
Scan.scan.com 192.168.1.221
192.168.1.222
19 2.168.1.223
When using nslookup scan.scan.com under CMD, the first IP number of successive resolved results is 221,222,223. At this level, it is also achieved a certain degree of load balance.
In addition, Oracle rules scan IP up to 3, at least 1.
settings for the DNS serverFirst, the location of the DNS server, the DNS server is common sense on a separate server independent of the node server. It has little contact with Oracle servers, providing domain resolution services primarily for all clients. Therefore, all clients ' DNS server addresses need to be IP for this server. However, if you do not have a separate server, you can also install the DNS service on the node, but because if the DNS service is in the same node that it directly affects access to the database, it is a good idea to install the DNS service on all nodes.
I am on the window server 2003R2 DNS, after the DNS server is built, create a new domain name (this domain can not actually exist), in this domain to create a new host, such as the establishment of host name scan, and then enter the IP address, Three corresponding DNS entries of different IP of the same host name can be established in sequence.
After you build it, you can use Nslookup to test it.some of the points of doubtMy experimental environment is two nodes, using the DNS method to implement resolution. So, a scan IP at a node, another two scan IP in another node, but if the server has more than 3 nodes, then this scan IP is not enough, is not a node is not working, no longer participate in load balance, the answer is definitely negative, but those who do not have to scan How does the node of IP work? This problem has been bothering me for some time.
Now my understanding is:
Although scan IP floats to a node, but is not bound to the instance of the node where it resides, the client accesses the scan IP that the domain name resolves, then the access request is processed by the scan layer according to the load balancing mechanism at the scan IP node. The processing result determines that the request is assigned to that VIP, which is the key to determining the node.