能够通过localhost而不是通过IP地址访问Oracle数据

能够通过localhost而不是通过IP地址访问Oracle数据

本文介绍了能够通过localhost而不是通过IP地址访问Oracle数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了Oracle 11g并且为了测试目的,我已经使用编辑器(称为DBeaver)连接到数据库。
当主机名提供一个localhost,它连接.But当主机名作为系统的IP提供时,编辑器无法连接并显示以下消息。

I have installed Oracle 11g and for test purpose I have connected to the database using an editor( called DBeaver).When host name is provided a localhost ,it connects .But when host name is provided as the IP of the system ,the editor fails to connect and displays following message.

IO Error: The Network Adapter could not establish the connection
  The Network Adapter could not establish the connection
    java.net.ConnectException: Connection refused: connect

我已尝试从

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.140.0.3)(PORT = 1521))
    )
  )

这里我用IP地址替换localhost,即10.140.0.3。
但到目前为止无法连接它。
任何人都可以分享这方面的经验?

Here I have replaced localhost with IP i.e. 10.140.0.3.But so far unable to connect it .Can anybody share some experience on this ?

推荐答案

您的listener.ora条目不正确。

Your listener.ora entry is incorrect .It should be like the following.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.140.0.3)(PORT = 1521))
    )
  )

为避免与手动编辑相关的错误,请使用Net manager并从那里添加地址。
检查以下屏幕截图以使listener.ora文件相关更改。

To avoid mistakes related to manual edit, use Net manager and add the address from there .Check the following screenshots to make the listener.ora file related changes .

更改完成后,不要忘记保存从Oracle Net Manager!

这篇关于能够通过localhost而不是通过IP地址访问Oracle数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 13:34