莫名其妙,日志中老是有无法连接oracle的异常
java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
先用oracle用户登录到服务器上
sqlplus /nolog
conn / as sysdba
运行了一些sql,一切正常呀,奇怪!
仔细想想,可能是lsnrctl的问题,打开listener.ora在下面插入以下内容:
(SID_DESC=
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = /oracle/10g)
(SID_NAME = ORCL)
)
完成后的listener.ora如下
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /oracle/10g)
(PROGRAM = extproc)
)
(SID_DESC=
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = /oracle/10g)
(SID_NAME = ORCL)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
)
)
保存后,重启lsnrctl服务后就可以正常联接了。