關於oracle11g RAC 監聽器問題

達芬奇的夢發表於2018-01-23
 

最近部署一個兩節點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<orapri></u/app/oracle/product/11g/db/network/admin>$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<orapri></u/app/oracle/product/11g/db/network/admin>$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<orapri></u/app/oracle/product/11g/db/network/admin>$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<orapri></u/app/oracle/product/11g/db/network/admin>$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<orapri></u/app/oracle/product/11g/db/network/admin>$

primary<orapri></u/app/oracle/product/11g/db/network/admin>$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<orapri></u/app/oracle/product/11g/db/network/admin>$

等待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<orapri></u/app/oracle/product/11g/db/network/admin>$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<orapri></u/app/oracle/product/11g/db/network/admin>$

primary<orapri></u/app/oracle/product/11g/db/network/admin>$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<orapri></u/app/oracle/product/11g/db/network/admin>$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<orapri></u/app/oracle/product/11g/db/network/admin>$

上述情況說明了一個重要的問題:local_listener引數的設定關係到今後客戶端是使用什麼型別的ip地址進行登陸資料庫。

接下來我們重點分析在本文中第六點中提到的no listener問題

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31444259/viewspace-2150439/,如需轉載,請註明出處,否則將追究法律責任。

相關文章