GRID和数据库版本:11.2.0.1
OS:Solaris 5.10
现象:在客户端连接scan ip时报错
sqlplus system/Oracle@210.10.4.5:1521/pdpt
ORA-12545: 因目标主机或对象不存在,连接失败
但两台数据库服务器之间连scan ip则没问题
# cat /etc/hosts
::1 localhost
127.0.0.1 localhost
210.10.4.5 taian-pt-d1 loghost
210.10.4.6 taian-pt-d2
210.10.4.9 taian-pt-d1-vip
210.10.4.10 taian-pt-d2-vip
210.10.4.7 pdpt-cluster-scan
192.168.2.1 taian-pt-d1-priv
192.168.2.2 taian-pt-d2-priv
经检查scan ip监听正常,客户端能ping通scan ip
-bash-3.2$ crs_stat -trac资源服务正常
Name Type Target State Host
------------------------------------------------------------
ora.ARCHDG.dg ora....up.type ONLINE ONLINE taian-pt-d1
ora.DATADG.dg ora....up.type ONLINE ONLINE taian-pt-d1
ora....ER.lsnr ora....er.type ONLINE ONLINE taian-pt-d1
ora....N1.lsnr ora....er.type ONLINE ONLINE taian-pt-d2
ora.OCRVT.dg ora....up.type ONLINE ONLINE taian-pt-d1
ora.asm ora.asm.type ONLINE ONLINE taian-pt-d1
ora.eons ora.eons.type ONLINE ONLINE taian-pt-d1
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora....network ora....rk.type ONLINE ONLINE taian-pt-d1
ora.oc4j ora.oc4j.type OFFLINE OFFLINE
ora.ons ora.ons.type ONLINE ONLINE taian-pt-d1
ora.pdpt.db ora....se.type ONLINE ONLINE taian-pt-d1
ora.scan1.vip ora....ip.type ONLINE ONLINE taian-pt-d2
ora....SM1.asm application ONLINE ONLINE taian-pt-d1
ora....D1.lsnr application ONLINE ONLINE taian-pt-d1
ora....-d1.gsd application OFFLINE OFFLINE
ora....-d1.ons application ONLINE ONLINE taian-pt-d1
ora....-d1.vip ora....t1.type ONLINE ONLINE taian-pt-d1
ora....SM2.asm application ONLINE ONLINE taian-pt-d2
ora....D2.lsnr application ONLINE ONLINE taian-pt-d2
ora....-d2.gsd application OFFLINE OFFLINE
ora....-d2.ons application ONLINE ONLINE taian-pt-d2
ora....-d2.vip ora....t1.type ONLINE ONLINE taian-pt-d2
-bash-3.2$ lsnrctl status LISTENER_SCAN1scan IP监听正常
LSNRCTL for Solaris: Version 11.2.0.1.0 - Production on 06-MAR-2012 09:36:50
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
STATUS of the LISTENER
------------------------
Alias LISTENER_SCAN1
Version TNSLSNR for Solaris: Version 11.2.0.1.0 - Production
Start Date 29-FEB-2012 13:42:48
Uptime 5 days 19 hr. 54 min. 1 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/app/grid_home/network/admin/listener.ora
Listener Log File /home/app/grid_home/log/diag/tnslsnr/taian-pt-d2/listener_scan1/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=210.10.4.7)(PORT=1521)))
Services Summary...
Service "PDPT" has 2 instance(s).
Instance "PDPT1", status READY, has 1 handler(s) for this service...
Instance "PDPT2", status READY, has 1 handler(s) for this service...
The command completed successfully
SQL> show parameter listener数据库实例的local_listener参数内容为vip的主机名
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
listener_networks string
local_listener string (DESCRIPTION=(ADDRESS_LIST=(AD
DRESS=(PROTOCOL=TCP)(HOST=taia
n-pt-d2-vip)(PORT=1521))))
remote_listener string pdpt-cluster-scan:1521
经Metalink上查找,发现这是11.2.0.1的小bug:“ORA-12545 or ORA-12537 while connecting to RAC through SCAN name[ID 970619.1]”,11.2.0.2及之后的版本就修复好了
Client is able to resolve all Fully Qualified Domain Name (FQDN) SCAN and VIP name but not short ones(without domain name) as its in different domain; even though FQDN names were specified during Grid Infrastructure setup, due to bug 9150053 by default DBCA set database parameter local_listener to short node VIP name while database is created.
因此只要把数据库实例参数local_listener内的host改为vip的IP地址即可。
NODE1:
SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=210.10.4.9)(PORT=1521))))' scope=both sid='PDPT1';
System altered.
SQL> alter system register;
System altered.
NODE2:
SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=210.10.4.10)(PORT=1521))))' scope=both sid='PDPT2';
System altered.
SQL> alter system register;
System altered.
参考:How to Troubleshoot Connectivity Issue with 11gR2 SCAN Name [ID 975457.1]
ORA-12545 or ORA-12537 while connecting to RAC through SCAN name[ID 970619.1]
11.2 Scan and Node TNS Listener Setup Examples [ID 1070607.1]