无法从局域网上的另一台计算机使用sqlplus访问oracle [英] Cannot access oracle using sqlplus from another machine on the LAN
问题描述
我让Oracle在LAN的一台计算机上运行.
发出以下命令时,我可以使用sqlplus连接到数据库:
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
这很好.
在局域网上的另一台计算机上,我已经安装了Oracle Instant Client(基本+ sdk + sqlplus).
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服务器已启动并且正在运行,并且可以通过网络访问,但是我无法连接到数据库.
Oracle server is up and running and is reachable on the network but I cannot connect to the database.
推荐答案
localhost
是特定的本地地址127.0.0.1
,只能从同一台计算机访问;另一台机器无法直接连接到仅针对localhost
注册的服务. oracle_server
将解析为(或如果您未使用主机名)机器上以太网接口的IP地址;在LAN上,这很可能以10.
或192.168.
开头,但也可能是其他内容.
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.
检查您的Oracle侦听器配置是否正在侦听外部地址以及localhost
.
Check your Oracle listener configuration is listening on the external address as well as localhost
.
话虽如此,如果这是唯一的问题,您可能会看到ORA-12541: TNS:no listener
而不是ORA-12543
.听起来好像Oracle服务器计算机上正在运行防火墙,如果这样,您需要对其进行配置以允许端口1521上的通信.
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.
另一种可能性是您在连接字符串中使用了主机名,而只是无法将其解析为IP地址.检查是否可以ping oracle_server
;如果显示类似cannot resolve oracle_server
之类的内容,请检查名称,看看是否需要提供完全限定的名称(oracle_server.example.com
),或一键将其添加到本地hosts
文件中.或者,在连接字符串中使用原始IP地址代替主机名.
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.
这篇关于无法从局域网上的另一台计算机使用sqlplus访问oracle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!