时间:2021-07-01 10:21:17 帮助过:35人阅读
APPLIES TO: Oracle Database - Enterprise Edition - Version 11.2.0.1 and later Information in this document applies to any platform. PURPOSE 11gR2 Grid Infrastructure (CRS) introduced Single Client Access Name (SCAN) to simplify client acce
11gR2 Grid Infrastructure (CRS) introduced Single Client Access Name (SCAN) to simplify client access to database services, this article is going to explain whats SCAN and how it works.
Intended audience will be DBAs who is installing/upgrading to 11gR2 Grid Infrastructure or support analyst who is supporting stated product.
The following is a list of commonly asked questions regarding SCAN:
During Typical installation, you are prompted to confirm the default Single Client Access Name (SCAN), which is used to connect to databases within the cluster irrespective of which nodes they are running on. If
you change the SCAN from the default, then the name that you use must be globally unique throughout your enterprise.
If the SCAN name resolves to one IP address, root script (root.sh or rootupgrade.sh) will create the number of SCAN VIP resources(ora.scan1.vip) and corresponding SCAN listener resource(ora.LISTENER_SCAN1.lsnr) depend on how many IP address the SCAN name resolves
to, i.e.if the SCAN name resolves to two IP addresses, it will create two SCAN VIP resources and two corresponding SCAN listener resource.
SCAN VIP and the corresponding SCAN listener works like a pair, when SCAN VIP fails over to other node, the corresponding SCAN listener will also be failed over to the same node.
When SCAN VIP fails over happens, it will always select a node with least running SCAN VIP, i.e., if SCAN VIP runs on node1, node2 and node3 of a 4-node cluster, if node3 goes down, the SCAN VIP and corresponding SCAN listener will be failed over to node4 as the other two nodes already have one SCAN VIP running on each node.
Also we can use 'srvctl' to add/modify the scan resource and the listeners. Please refer to "Real Application Clusters Admin and Deployment Guide" or Note 1053147.1 for more information.
Yes, you would need to configure independent local listeners for each node. SCAN listeners are not replacements for the node listeners.
A new set of cluster processes called scan listeners will run on three nodes in a cluster (or all nodes if there are less than 3). If you have more than three nodes, regardless of the number of nodes you have, there will be at most three scan listeners. The
database registers with the SCAN listener through the remote listener parameter in the init.ora/spfile. If any of these clustered processes fail, they are automatically restarted on a new node.
The following is the explanation given in Appendex D "Oracle Grid Infrastructure for a Cluster Installation Concepts" of the Oracle Grid Infrastructure Installation Guide:
"When a client submits a request, the SCAN listener listening on a SCAN IP address and the SCAN port is contracted on a client's behalf. Because all services on the cluster are registered with the SCAN listener, the SCAN listener replies with the address of
the local listener on the least-loaded node (Each scan listener keeps updated cluster load statistics) where the service is currently being offered. Finally, the client establishes connection to the service through the listener on the node where service is
offered.All of these actions take place transparently to the client without any explicit configuration required in the client."
$ SRVCTL STATUS SCAN_LISTENER
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node TEST1
SCAN Listener LISTENER_SCAN2 is enabled
SCAN listener LISTENER_SCAN2 is running on node TEST2
SCAN Listener LISTENER_SCAN3 is enabled
SCAN listener LISTENER_SCAN3 is running on node TEST3
Oracle strongly recommends that you do not configure SCAN VIP addresses in the hosts file. But if you use the hosts file to resolve SCAN name, you can have only one SCAN IP address.
If hosts file is used to resolve SCAN hostname, you will receive Cluster Verification Utility failure at end of installation (See NOTE 887471.1 for more details)
Clients can continue to access the cluster in the same way as with previous releases. Vips are still used internally, and can still be used for connections. But Oracle strongly recommends that clients accessing the cluster use the SCAN. Clients using the SCAN can also access the cluster using EZCONNECT.
It's highly recommended to use SCAN unless there's strong business reason preventing it from being used.
SCAN is an elementary part of 11gR2 Grid Infrastructure, it's not supported to remove SCAN.
As a Best Practice, Oracle recommends using the COST feature to restrict instance registration with SCAN listeners as part of your standard listener configuration. Refer to note
1340831.1 for more details.
SCAN DEMO
Sample TNS entry for SCAN
TEST.ORACLE.COM =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=SCAN-TEST.ORACLE.COM)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=11GR2TEST.ORACLE.COM))
)
Sample TNS Entry without SCAN
TEST.ORACLE.COM =
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=TEST1-vip.ORACLE.COM)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=TEST2-vip.ORACLE.COM)(PORT=1521))
)
(CONNECT_DATA=(SERVICE_NAME=11GR2TEST.ORACLE.COM))
)