手机版
你好,游客 登录 注册
背景:
阅读新闻

Oracle 11g RAC 监听器使用详解

[日期:2017-11-29] 来源:Linux社区  作者:流浪的野狼 [字体: ]

最近部署一个两节点Oracle RAC 环境,刚刚开始没怎么留意,但当在使用的时候竟然scan-ip无法通过客户端登陆使用,但是在两个节点上可正常使用,此外vip无论在节点上还是其他客户端使用完全ok

在安装GI的时候最后报错,但经查看官方文档说是可能scan-ip写到hosts文件中了,但本人环境中三个scan-ip均为加入到hosts文件中,故此直接忽略掉该报错。

下面是本人详细的排错过程:

1.          任意节点上使用tnsnames.ORA透过scan-ip登陆数据库:

[grid@RAC01 admin]$ tnsping RACDB

TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 02-JAN-2014 18:41:16

Copyright (c) 1997, 2009, Oracle.  All rights reserved.

Used parameter files:

/u/app/11.2.0/grid/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.134.30.50)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = RACDB)))

OK (0 msec)

[grid@RAC01 admin]$ sqlplus scott/testpassword@RACDB

SQL*Plus: Release 11.2.0.1.0 Production on Thu Jan 2 18:41:27 2014

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,

Data Mining and Real Application Testing options

SQL>

2.          检查RAC上的scan-ip配置:

[grid@RAC01 ~]$ srvctl config scan

SCAN name: RACSCAN.localdomain., Network: 1/10.134.30.0/255.255.255.0/eth0

SCAN VIP name: scan1, IP: /RACSCAN.localdomain/10.134.30.50

SCAN VIP name: scan2, IP: /RACSCAN.localdomain/10.134.30.51

SCAN VIP name: scan3, IP: /RACSCAN.localdomain/10.134.30.52

[grid@RAC01 ~]$ srvctl config scan_listener

SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521

SCAN Listener LISTENER_SCAN2 exists. Port: TCP:1521

SCAN Listener LISTENER_SCAN3 exists. Port: TCP:1521

3.          DNS测试:

[root@RAC01 ~]# nslookup RACSCAN.localdomain.

Server:        10.134.30.27

Address:        10.134.30.27#53

Name:  RACSCAN.localdomain

Address: 10.134.30.52

Name:  RACSCAN.localdomain

Address: 10.134.30.50

Name:  RACSCAN.localdomain

Address: 10.134.30.51

[grid@RAC01 ~]$ nslookup 10.134.30.50

Server:        10.134.30.27

Address:       10.134.30.27#53

50.30.134.10.in-addr.arpa      name = RACSCAN.localdomain.

[grid@RAC01 ~]$ nslookup 10.134.30.51

Server:        10.134.30.27

Address:        10.134.30.27#53

51.30.134.10.in-addr.arpa      name = RACSCAN.localdomain.

[grid@RAC01 ~]$ nslookup 10.134.30.52

Server:        10.134.30.27

Address:        10.134.30.27#53

52.30.134.10.in-addr.arpa      name = RACSCAN.localdomain.

多次运行nslookup RACSCAN.localdomain.可观察到scan-ip轮询没有任何问题,反向解析亦没有任何问题。

4.          Ping三个scan-ip没有任何问题:

primary$ping 10.134.30.47

PING 10.134.30.47 (10.134.30.47) 56(84) bytes of data.

64 bytes from 10.134.30.47: icmp_seq=1 ttl=63 time=0.508 ms

primary$ping 10.134.30.48

PING 10.134.30.48 (10.134.30.48) 56(84) bytes of data.

64 bytes from 10.134.30.48: icmp_seq=1 ttl=63 time=0.522 ms

primary$ping 10.134.30.50

PING 10.134.30.50 (10.134.30.50) 56(84) bytes of data.

64 bytes from 10.134.30.50: icmp_seq=1 ttl=63 time=0.514 ms

5.          在任意客户端测试可否登陆:

primary$tnsping guijian

TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 02-JAN-2014 19:12:15

Copyright (c) 1997, 2009, Oracle.  All rights reserved.

Used parameter files:

/u/app/oracle/product/11g/db/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = RACSCAN.localdomain.)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = RACDB)))

OK (0 msec)-------------------------à此处透过scan-iptnsping正常

primary$

primary$sqlplus scott/Testpassword@guijian

SQL*Plus: Release 11.2.0.1.0 Production on Thu Jan 2 19:08:06 2014

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

ERROR:

ORA-12170: TNS:Connect timeout occurred

primary$

等待N久之后提示超时,但此时的tnsping正常,起初测试也曾提示提示 no listener

6.          检查监听器配置:

[grid@RAC01 admin]$ cat 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

LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2))))                # line added by Agent

LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN3))))                # line added by Agent

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=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

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON              # line added by Agent

监听器配置没有问题,为了方便本人讲两个节点的listener.ora文件内容修改为一模一样的配置。

[grid@RAC01 admin]$

LSNRCTL> status

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))

STATUS of the LISTENER

------------------------

Alias                    LISTENER

Version                  TNSLSNR for Linux: Version 11.2.0.1.0 - Production

Start Date                02-JAN-2014 16:56:51

Uptime                    0 days 1 hr. 36 min. 54 sec

Trace Level              off

Security                 ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File  /u/app/11.2.0/grid/network/admin/listener.ora

Listener Log File        /u/app/grid/diag/tnslsnr/RAC01/listener/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.134.30.27)(PORT=1521)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.134.30.47)(PORT=1521)))

The listener supports no services

The command completed successfully

此时看到监听器no services,其实所有的问题都是与这个no services有关的,后续的内容中我会重点关注解决这个问题。

经过初步的检测个人感觉问题不可能出在服务器监听这一块。故此怀疑可能出在与监听相关的初始化参数上。

7.          检查数据库两个与监听相关的参数:

SQL> show parameter local_lis

NAME                                TYPE        VALUE

------------------------------------ ----------- ------------------------------

local_listener                      string      (DESCRIPTION=(ADDRESS_LIST=(AD

                                                DRESS=(PROTOCOL=TCP)(HOST=RAC0

                                                2-vip)(PORT=1521))))

SQL> show parameter remote_lis

NAME                                TYPE        VALUE

------------------------------------ ----------- ------------------------------

remote_listener                      string      RACSCAN.localdomain.:1521

SQL> show parameter local_lis

NAME                                TYPE        VALUE

------------------------------------ ----------- ------------------------------

local_listener                      string      (DESCRIPTION=(ADDRESS_LIST=(AD

                                                 DRESS=(PROTOCOL=TCP)(HOST=RAC0

                                                1-vip)(PORT=1521))))

SQL> show parameter remote_lis

NAME                                TYPE        VALUE

------------------------------------ ----------- ------------------------------

remote_listener                      string      RACSCAN.localdomain.:1521

SQL>

注意上述中的local_listener参数的配置,发现时指向vip的;

8.          修改该参数指向scan-ip

SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=RACSCAN.localdomain.)(PORT=1521))))';

System altered.

9.          客户端再次测试:

primary$tnsping guijian

TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 02-JAN-2014 19:39:25

Copyright (c) 1997, 2009, Oracle.  All rights reserved.

Used parameter files:

/u/app/oracle/product/11g/db/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = RACSCAN.localdomain.)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = RACDB)))

OK (10 msec)

primary$

primary$sqlplus scott/testpassword@guijian

SQL*Plus: Release 11.2.0.1.0 Production on Thu Jan 2 19:40:26 2014

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,

Data Mining and Real Application Testing options

SCOTT@guijian>

此时可以看到顺利登陆。此外该参数修改为scan-ip后,在此再客户端尝试着使用vip登陆时开始报错:

primary$sqlplus scott/Testpassword@guijian

SQL*Plus: Release 11.2.0.1.0 Production on Thu Jan 2 19:42:54 2014

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

ERROR:

ORA-12514: TNS:listener does not currently know of service requested in connect

descriptor

Enter user-name:

primary$

上述情况说明了一个重要的问题:local_listener参数的设置关系到今后客户端是使用什么类型的ip地址进行登陆数据库。

接下来我们重点分析在本文中第六点中提到的no listener问题 见 http://www.linuxidc.com/Linux/2017-11/148976.htm

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

本文永久更新链接地址http://www.linuxidc.com/Linux/2017-11/148975.htm

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款