Oracle 11g GRID SCAN小结

 

           SCAN是oracle 11g Grid 的一个新特性,Grid Infrastructure Single Client Access Name (SCAN),客户端访问数据库做一个简单的介绍:

1.scan是怎么样工作的:

oracle的说法是:

        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.

          SCAN IP其实是Oracle在客户端与数据库之间,新加的一个连接层,当有客户端访问时连接到SCAN IP Listener。而SCAN IP Listener接收到连接请求时,会根据 LBA 算法(LBA算法,简单说就是least loaded instance),将客户端的连接请求,转发给最小负载节点上的VIP Listener,从而实现整个客户端与服务器的连接过程。

      

如下图:

Oracle 11g GRID SCAN小结_第1张图片

连接的过程大概是:

client ----request----> scan listener ----转发----> local listener ---> local instance

 

2.客户端连接配置

客户端TNSNAMES.ORA配置
TEST.ORACLE.COM = (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=SCAN-TEST.ORACLE.COM)(PORT=1521)) (CONNECT_DATA=(SERVICE_NAME=11GR2TEST.ORACLE.COM)))

如果是10g需要使用VIP,则是如下配置

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)))

 

3.对于scan listener的工作保障集群:

负载均衡:LBA算法保证客户的连接请求被scan listener分配到负载最小的节点上。

Failover:client side的failover会根据连接的tns的address列表连接在建立连接时就会做出failover的选择,选择一个可用的连接。

 

By DBA老菜
=========================================================================

-- The End --

你可能感兴趣的:(oracle,grid,scan)