ORA-12545 / TNS-12545

ORA-12545 / TNS-12545:

rac配置了 local_listener也会有ora-12545 --处理方法
2009-12-17 21:38

甚至有时会出现一种情况:

有时能用有时会报ora-12545

日前在itpub上也刚刚帮人处理了个这样的问题:

问题:

rac 环境 ora-12545 错误 local_listener已经配了


local_listener 两个节点都配了
还是ora-12545麻烦各位看看什么问题


hosts
#private network-eth1
10.0.0.19 moon-priv
10.0.0.21 sun-priv

#public network-eth0
192.168.1.19 moon
192.168.1.21 sun

#public virtul ip -eth0
192.168.1.20 moon-vip
192.168.1.22 sun-vip

SQL> show parameter local

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string (ADDRESS = (PROTOCOL = TCP)(HO
ST = sun-vip)(PORT = 1521))
log_archive_local_first boolean TRUE
SQL> show parameter remote

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_archive_enable string true
remote_dependencies_mode string TIMESTAMP
remote_listener string leetaf
remote_login_passwordfile string EXCLUSIVE
remote_os_authent boolean FALSE
remote_os_roles boolean FALSE


lsnrctl service
...
...
...
Service "leetaf" has 2 instance(s).
Instance "leerac1", status READY, has 2 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
REMOTE SERVER
(ADDRESS=(PROTOCOL=TCP)(HOST=moon-vip)(PORT=1521))
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
Instance "leerac2", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
REMOTE SERVER
(ADDRESS=(PROTOCOL=TCP)(HOST=sun-vip)(PORT=1521))
The command completed successfully

客户端
tnsnames.ora
。。。
。。。
leerac1=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.20)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = leetaf)
(INSTANCE_NAME = leerac1)
)
)

leerac2=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.22)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = leetaf)
(INSTANCE_NAME = leerac2)
)
)



leetaf2 =
(DESCRIPTION =
(LOAD_BALANCE = yes)
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.20)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.22)(PORT = 1521))
(connect_data=(SERVICE_NAME = leetaf))
)


连接时候总报错
ora-12545 因目标主机或对象不存在,连接失败

答案:

客户端
tnsnames.ora
。。。
。。。
leerac1=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.20)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = leetaf)
(INSTANCE_NAME = leerac1)
)
)

leerac2=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.22)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = leetaf)
(INSTANCE_NAME = leerac2)
)
)



leetaf2 =
(DESCRIPTION =
(LOAD_BALANCE = yes)
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.20)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.22)(PORT = 1521))
(connect_data=(SERVICE_NAME = leetaf))
)


试试上面不要这样写,而采用下面的方式:
修改/etc/hosts加上
192.168.1.20 moon-vip
192.168.1.22 sun-vip


然后tnsnames.ora里面不要直接用ip,而是用moon-vip和sun-vip
再不行把
#public network-eth0
192.168.1.19 moon
192.168.1.21 sun

也加到hosts文件里

如果windows就改 system32/drivers/etc/hosts

结果:

回复 #10 wa0362 的帖子

加了在客户端配了 hosts 好了

帖子连接:http://www.itpub.net/viewthread.php?tid=1247264&extra=&page=1

猜测两种可能的原因:以下内容纯属猜测,没找到官方文档证明

当有监听器的LOAD_BALANCE时 ,每当client建立一个链接的时候listener是需要给client一个地址去连接的,但是它给的并不是ip,而是给的hostname,所以客户端再用这个hostname去链接的时候自然就要报"ora-12545 因目标主机或对象不存在,连接失败"

或者是假如要被重定向到remote listener是会用hostname去连接,而如果是local listener则因为已经建立连接就会能成功

nnd,白猜了,metalink找到官方证据了[ID 553328.1]

Problem : Client connections to RAC database servers fail with ORA-12545 / TNS-12545

Cause: One of the hostname (which corresponds to public IP or VIP) is not reachable from this client machine.
When the server side load balancing is enabled in the RAC setup, the listener will redirect the connection to the least loaded node.While doing so, the server sends the packet NSPTRD containing the hostname of the corresponding machine.


from:

http://hi.baidu.com/wa0362/blog/item/93e400eff3a0abe4cf1b3e03.html/cmtid/7eb3621f21c3c76ff724e4a9

你可能感兴趣的:(ora)