1.昨天发布tomcat 成功,但登录后报错,无法打开hibernate session,检查后发现数据库无法连接
2.用PL/SQL登录数据库,报 ora-12541,TNS 无监听程序,百度发现需要配置监听,不得其解,因为我也没动过数据库,就尝试按照方法配置一遍
可以参考 http://www.cnblogs.com/Venom/p/3953025.html
然后不停重启
3.还是不行,又查到说在安装目录下更改文件配置,私以为两者应该效果一样。还是找到目录下文件打开瞅瞅
我的目录是:E:appalbertfgproduct11.2.0dbhome_1NETWORKADMIN
在该目录下有3个文件:listener.ora;sqlnet.ora;tnsnames.ora;
4.第一个文件:
# listener.ora Network Configuration File: E:appusernameproduct11.2.0dbhome_1 etworkadminlistener.ora # Generated by Oracle configuration tools. SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = ORCL) (ORACLE_HOME = E:appusernameproduct11.2.0dbhome_1) (SID_NAME = ORCL) ) (SID_DESC = (SID_NAME = CLRExtProc) (ORACLE_HOME = E:appalbertfgproduct11.2.0dbhome_1) (PROGRAM = extproc) (ENVS = "EXTPROC_DLLS=ONLY:E:appusernameproduct11.2.0dbhome_1inoraclr11.dll") ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.101)(PORT = 1521)) ) ) ADR_BASE_LISTENER = E:appusername
5:第三个文件:
# tnsnames.ora Network Configuration File: E:appusernameproduct11.2.0dbhome_1 etworkadmin nsnames.ora # Generated by Oracle configuration tools. ORACLR_CONNECTION_DATA = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) (CONNECT_DATA = (SID = CLRExtProc) (PRESENTATION = RO) ) ) LISTENER_ORCL = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) ORCL = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.101)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = ORCL) ) )
6.这样改完仍没用,报ora-12514
后来又百度发现重启oracle服务器,无奈,重启了一下电脑,恢复正常了。
7.小结:后来回想,主要是局域网内IP地址动态分配的,虽然我给了服务器固定ip,但昨天由于回来迟了,室友先开了机,恰巧又分配了服务器的ip地址
导致我的配置失效。记得以前也出现过一次,可惜没长记性,所以还是写点简单的记录吧。