Cannot access oracle using sqlplus from another machine on the LAN

主宰稳场 提交于 2019-12-08 04:26:46

问题


I have Oracle running on one machine of the LAN.
I can connect to the DB with sqlplus when I issue:

sqlplus myuser/mypass@localhost:1521/orcl

This works fine.

On another machine from the LAN, I have installed oracle instant client (basic + sdk + sqlplus).

sqlplus myuser/mypass@oracle_server:1521/orcl
SQL*Plus: Release 11.2.0.3.0 Production on Sat Feb 25 09:10:41 2012

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

ERROR:
ORA-12543: TNS:destination host unreachable

Enter user-name: 

Oracle server is up and running and is reachable on the network but I cannot connect to the database.


回答1:


localhost is a specific local address, 127.0.0.1, which is only reachable from the same machine; another machine cannot connect directly to a service registered only against localhost. oracle_server will be resolve to (or be if you aren't using a host name) the IP address of an ethernet interface on the machine; on a LAN this is likely to start with 10. or 192.168. but could be something else.

Check your Oracle listener configuration is listening on the external address as well as localhost.

Having said that, if that was the only problem you'd probably see ORA-12541: TNS:no listener rather than ORA-12543. This sounds like there may be a firewall running on the Oracle server machine, and if so you need to configure that to permit traffic on port 1521.

Another possibility is that you're using a host name in your connect string and you just can't resolve that to an IP address. Check you can ping oracle_server; if that says something like cannot resolve oracle_server then check the name, see if you need to give a fully-qualified name (oracle_server.example.com), or at a push add it to your local hosts file. Or, use the raw IP address in the connect string instead of the host name.



来源:https://stackoverflow.com/questions/9442415/cannot-access-oracle-using-sqlplus-from-another-machine-on-the-lan

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!