OracleOraHome92TNSListener 启动后刷新又关闭

今天在Eclipse里写代码测试Oracle连接,报错:java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection

查看Oracle如下服务都是启动起的:
OracleOraHome92TNSListener
OracleServiceORCL
我就纳闷了,于是上网搜索解决方案,偶然看一回帖,“OracleOraHome92TNSListener 刷新下该服务呢”。我就刷新一试,发现自动关闭了。于是去了C:\oracle\ora92\network\log目录下查看listener.log找到出错点Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=win-connector)(PORT=1521))),然后cmd进命令行ping win-connector拼通,但当前计算机名全名为n194-h14.test.com,hostname拼为n194-h13,于是我改了C:\oracle\ora92\network\admin\listener.ora的这一行
        (ADDRESS = (PROTOCOL = TCP)(HOST = win-connector)(PORT = 1521))的HOST=n194-h14,再启动服务OracleOraHome92TNSListener就可以了。
另一种办法:
打开C:\WINDOWS\system32\drivers\etc\hosts文件,
引用

10.11.194.11  n194-h11 n194-h11.test.com
10.11.194.12  n194-h12 n194-h12.test.com win-connector
10.11.194.13  n194-h13 n194-h13.test.com linux-connector
10.11.194.14  n194-h14 n194-h14.test.com


改成
引用

10.11.194.11  n194-h11 n194-h11.test.com
10.11.194.12  n194-h12 n194-h12.test.com
10.11.194.13  n194-h13 n194-h13.test.com linux-connector
10.11.194.14  n194-h14 n194-h14.test.com win-connector
也可以。

你可能感兴趣的:(listener)