客户端用INSTANCE NAME 连接正常,用SERVICE NAME连接有错;如果仅开一台则无论怎么连都正常。
在服务器本机怎么连都正常。
问题号: ORA- 12545 Connect failed because target host or object does not exist
The information in this article applies to:
Oracle Net Services - Version: 9.2.0.4This problem can occur on any platform.
Errors
ORA-12545 Connect failed because target host or object does not existSymptoms
- RAC 9.2.0.4 on LinuxOn Node arch1
- local_listener in init.ora pointing to a tnsnames.ora alias pointing to a local listener using hostname
arch1 and port 1521
- remote_listener in init.ora pointing to a tnsnames.ora alias pointing to a
- local listener using hostname arch1 and port 1521
- remote listener using hostname arch2 and port 1521
(so basically one alias with 2 addresses)
On Node arch2
- identical setup as on Node arch1 (replace arch1 by arch2 and visa versa)
- Windows client (any release)
- tnsnames.ora contains the ip-address of both arch1 and arch2.
so, one alias contains 2 addresses (ip-address for arch1 first)
Symptoms:
- client can connect (always to arch1 instance) but fails with an ORA 12545 every few tries to
connect using the same sqlnet alias.
Cause
Incorrect setup of the TCP/IP stack.hostname of the servers was unknown to the client
When the client connects, the first address in the sqlnet alias is used. In this case it is the ip-address of the arch1 node. The client is able to talk to the listener on arch1 (using the ip-address) and connects to the Database.
Next time, a new connection is made, the same listener is contacted, but this time the listener decides to 'transfer' the client to the other listener (due to load balancing) and tells the client to reconnect again
but this time using the hostname (as configured in the tnsnames.ora on the server as explained above)
of the otherr host, namelu arch2.
Unfortunately, the client cannot resolve the hostname arch2 and fails with the ORA 12545.
Fix
Make sure that the hostname of both servers in the RAC are known to the clientThere are 2 options:
- make sure all clients can resolve both the arch1 and arch2 hostnames (recommended)
- use the ip-address of both nodes in the tnsnames.ora and listener.ora on both servers
(not recommended) .