Chinaunix首页 | 论坛 | 博客
  • 博客访问: 815399
  • 博文数量: 199
  • 博客积分: 6363
  • 博客等级: 准将
  • 技术积分: 2225
  • 用 户 组: 普通用户
  • 注册时间: 2007-04-28 10:01
个人简介

来自农村的老实娃

文章分类

全部博文(199)

文章存档

2017年(1)

2014年(2)

2013年(3)

2012年(6)

2011年(26)

2010年(34)

2009年(50)

2008年(44)

2007年(33)

我的朋友

分类: Oracle

2011-12-28 11:01:29

In this Document
  Goal
  Solution
     Setup SCAN for your Cluster.
     Verify SCAN Listener Configuration on Server
     Configure Client to Connect Using SCAN
     Configure Clients for Transparent Application Failover (TAF) Using SCAN
     Client Side Load Balancing
  References
 
--------------------------------------------------------------------------------
Platforms: 1-914CU;

This document is being delivered to you via Oracle Support's Rapid Visibility (RaV) process and therefore has not been subject to an independent technical review.
 
Applies to:
Oracle Net Services - Version: 11.2.0.1 and later   [Release: 11.2 and later ]
Information in this document applies to any platform.
Goal
Setup SCAN listener and Clients to use SCAN listener to connect to 11gR2 RAC using SCAN.
Solution
 
Setup SCAN for your Cluster.
  For details on what is SCAN and how to setup SCAN for your cluster please check the video

 Video - Setup SCAN and Configure SCAN Listener. Client Configuration for TAF and Load Balancing (29:00) 
Verify SCAN Listener Configuration on Server
After grid installation is completed you can verify the SCAN Listener configuration on your server -
?At the $GRID_HOME/network/admin directory you will have two listener related files.
                 -rw-r--r-- 1 grid oinstall 887 Jul 13 09:33 listener.ora
                 -rw-r--r-- 1 grid oinstall 375 Jul 13 09:33 endpoints_listener.ora
example of listener.ora
 

LISTENER_SCAN3=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN3)))) # line added by Agent
LISTENER_SCAN2=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2)))) # line added by Agent
LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))) # line added by Agent
LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN2=ON # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN3=ON # line added by Agent
 example of endpoints_listener.ora
LISTENER_DBGRAC1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=myrac1-vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=10.17
7.60.87)(PORT=1521)(IP=FIRST)))) # line added by Agent
 
Check Status of SCAN IPs and SCAN Listener
srvctl command can be used to check the status of SCAN IPs and SCAN listener -
  [grid@myrac1 admin]$ srvctl status scan
  SCAN VIP scan1 is enabled
  SCAN VIP scan1 is running on node myrac2
  SCAN VIP scan2 is enabled
  SCAN VIP scan2 is running on node myrac1
  SCAN VIP scan3 is enabled
  SCAN VIP scan3 is running on node myrac1
Note that two SCAN IPs are online on node myrac1 and one is online on myrac2.
Respective SCAN listeners will be online on the nodes where the corresponding SCAN IP is online.
  [grid@myrac1 admin]$ srvctl status scan_listener
  SCAN Listener LISTENER_SCAN1 is enabled
  SCAN listener LISTENER_SCAN1 is running on node myrac2
  SCAN Listener LISTENER_SCAN2 is enabled
  SCAN listener LISTENER_SCAN2 is running on node myrac1
  SCAN Listener LISTENER_SCAN3 is enabled
  SCAN listener LISTENER_SCAN3 is running on node myrac1 You can verify the instance registration with SCAN listeners using lsnrctl command -
 
 [grid@myrac1 admin] $ lsnrctl status listener_scan2
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 28-AUG-2010 12:53:56
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2)))
STATUS of the LISTENER
------------------------
Alias LISTENER_SCAN2
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 23-AUG-2010 10:15:16
Uptime 5 days 2 hr. 38 min. 40 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/app/11.2.0/grid/log/diag/tnslsnr/myrac1/listener_scan2/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN2)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=111.222.333.90)(PORT=1521)))
Services Summary...
Service "myrac" has 2 instance(s).
Instance "myrac1", status READY, has 2 handler(s) for this service...
Instance "myrac2", status READY, has 2 handler(s) for this service...
Service "myracXDB" has 2 instance(s).
Instance "myrac1", status READY, has 1 handler(s) for this service...
Instance "myrac2", status READY, has 1 handler(s) for this service...
The command completed successfully
Note that above output shows that the listener "listener_scan2" is running on myrac1 and both the instances are registered with this listener. Each instance within the cluster registers itself with all the SCAN listener using remote_listener setting. For e.g
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)   HOST=myrac1-vip)(PORT=1521))))
remote_listener string myrac-cluster-scan:1521
The local_listener will always point to the local VIP for the node while the remote_listener will point to :
 

You can use srvctl command to change or edit the SCAN listener settings. Refer Note 972500.1 : How to Modify SCAN Setting after Installation.

 
Configure Client to Connect Using SCAN
To configure client to connect using SCAN, configure the tnsnames.ora. For e.g -
MYRAC =
(DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = myrac-cluster-scan)(PORT = 1521))
  (CONNECT_DATA =
     (SERVER = DEDICATED)
     (SERVICE_NAME = myrac)
  )
 ) 
Configure Clients for Transparent Application Failover (TAF) Using SCAN
The above tns entry will connect to cluster using SCAN name "myrac-cluster-scan" to service "myrac" and assumes that the service is configured for server side TAF. The default Service created at the time of installation and creation of RAC database is not TAF enabled. You can create a TAF enabled service using srvctl command. Refer Note 460982.1: How To Configure Server Side Transparent Application Failover

If you wish to use client side TAF setting for clients connecting using SCAN name, you can configure tnsnames.ora entry at the client side as -
MYRAC_TAF =
 (DESCRIPTION =
   (ADDRESS = (PROTOCOL = TCP)(HOST = myrac-cluster-scan)(PORT = 1521))
 (CONNECT_DATA =
   (SERVER = DEDICATED)
   (SERVICE_NAME = myrac)
     (FAILOVER_MODE=
       (TYPE=select)
       (METHOD=basic))))
You can verify the client connections to 11gR2 database for TAF using -
 

SQL> SELECT MACHINE, FAILOVER_TYPE, FAILOVER_METHOD, FAILED_OVER, COUNT(*)
FROM V$SESSION
GROUP BY MACHINE, FAILOVER_TYPE, FAILOVER_METHOD, FAILED_OVER;

MACHINE    AILOVER_TYPE FAILOVER_M FAI COUNT(*)
--------- ------------- --------- ----- ---
mymachine    SELECT        BASIC    NO   1

Older supported client versions which are using VIP Address TAF enabled connect string can continue use VIP to connect to 11gR2 RAC setup.

Client Side Load Balancing
For 11.2 clients connecting to 11.2 RAC database via SCAN, the client side load balancing happens during the connection phase when the SCAN name gets resolved. Client side sqlnet trace can be used to verify this. For e.g
 
(3086231232) [28-AUG-2010 14:13:06:118] nlad_expand_hst: Expanding myrac-cluster-scan
(3086231232) [28-AUG-2010 14:13:06:118] snlinGetAddrInfo: entry
(3086231232) [28-AUG-2010 14:13:11:119] snlinGetAddrInfo: exit
(3086231232) [28-AUG-2010 14:13:11:119] snlinGetNameInfo: entry
(3086231232) [28-AUG-2010 14:13:11:119] snlinGetNameInfo: exit
(3086231232) [28-AUG-2010 14:13:11:119] nlad_expand_hst: Adding IP 111.222.333.90
(3086231232) [28-AUG-2010 14:13:11:119] snlinGetNameInfo: entry
(3086231232) [28-AUG-2010 14:13:11:119] snlinGetNameInfo: exit
(3086231232) [28-AUG-2010 14:13:11:119] nlad_expand_hst: Adding IP 111.222.333.191
(3086231232) [28-AUG-2010 14:13:11:119] snlinGetNameInfo: entry
(3086231232) [28-AUG-2010 14:13:11:119] snlinGetNameInfo: exit
(3086231232) [28-AUG-2010 14:13:11:119] nlad_expand_hst: Adding IP 111.222.333.193
(3086231232) [28-AUG-2010 14:13:11:119] snlinFreeAddrInfo: entry
Note that the name myrac-cluster-scan was resolved to three different IPs, client will randomly pick any of the IP for the connection to achieve client side load balancing.
A pre-11g Release 2 client (Oracle Database 11g Release 1 or Oracle Database 10g Release 2, or older) will not fully benefit from the advantages of SCAN. The older version Oracle Client will not be able to handle a set of three IPs returned by the DNS for SCAN. Hence, it will try to connect to only the first address returned in the list and will more or less ignore the others. If the SCAN Listener listening on this specific IP is not available or the IP itself is not available, the connection will fail.
To workaround this problem -
?If you are using static SCAN IPs, include the address of all SCAN IPs in the tnsnames.ora entry.

  TEST  =
    (DESCRIPTION =
     (ADDRESS_LIST =
      (LOAD_BALANCE=ON)
      (FAILOVER=ON)
      (ADDRESS = (PROTOCOL = TCP)(HOST = )(PORT = 1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = )(PORT = 1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = )(PORT = 1521))
     )
    (CONNECT_DATA =
     (SERVER = DEDICATED)
     (SERVICE_NAME = myrac)
     (FAILOVER_MODE=
      (TYPE=select)
      (METHOD=basic))))
 
?If you are using GNS (dynamic SCAN IPs), use VIP listener for the connections.

However in this case the remote_listener parameter on each node should be set accordingly so that all instance cross registers with each VIP listener within the cluster.
 
阅读(1551) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~