oracle11g本地可以访问但局域网无法访问
问题描述,现在有两台电脑 A 和 B :
1)电脑 A 上有 Oracle11G服务端; ip地址 192.168.1.198; 端口1521;
2)电脑 A 本机连接数据库正常,可以登录及操作等;
3)电脑B配置访问电脑A时报错:ORA-12541:TNS:无监听程序
报这种错的话,网上有说法,说是防火墙没关,或者是服务端服务没启好等,按本人的实际情况解说:因为oracle服务端访问配置是需要配置访问地址监听的,具体见Oracle安装路径:% product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora,这个是我的oracle监听服务的配置文件,内容如下:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
# listener.ora Network Configuration File: E:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora # Generated by Oracle configuration tools. SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = CLRExtProc) (ORACLE_HOME = E:\app\Administrator\product\11.2.0\dbhome_1) (PROGRAM = extproc) (ENVS = "EXTPROC_DLLS=ONLY:E:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll") ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.190)(PORT = 1521)) ) ) ADR_BASE_LISTENER = E:\app\Administrator
这时候我可以采用两种方法来解决:
方法一:直接用下面的语句覆盖掉listener.ora中的内容,之后重启oracle和监听器即可。
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
# listener.ora Network Configuration File: E:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora # Generated by Oracle configuration tools. SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = CLRExtProc) (ORACLE_HOME = E:\app\Administrator\product\11.2.0\dbhome_1) (PROGRAM = extproc) (ENVS = "EXTPROC_DLLS=ONLY:E:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll") ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = SKY-20130705VGC)(PORT = 1521)) ) ) ADR_BASE_LISTENER = E:\app\Administrator
方法二:用windows下的oracle的监听配置工具,把监听重新配置一次,之后重启oracle和监听器即可。重新配置监听器的方法如下:
参考资料:
http://www.dedecms.com/knowledge/data-base/oracle/2012/1214/17634.html
http://blog.csdn.net/wwbmyos/article/details/11475551