ORA:12541:TNS:无监听程序
在安装Oracle数据库的过程中出了一系列问题,当终于排除艰难万险把数据库装上的时候,一个和数据库连接的小软件又出现了错误,PL/SQL Developer,一连接就会出现ora-12541:TNS:无监听程序,真是被搞得头大,于是在网上找了找大牛们的解决办法,记录一下,避免以后犯错。
1. 检查oracle/product/10.1.0/db_1/NETWORK/log/listener.log:
TNSLSNR for 32-bit Windows: Version 10.1.0.2.0 - Production on 04-1月 -2010 13:38:34
Copyright (c) 1991, 2004, Oracle. All rights reserved.
系统参数文件为D:/oracle/product/10.1.0/db_1/network/admin/listener.ora
写入D:/oracle/product/10.1.0/db_1/network/log/listener.log的日志信息
写入D:/oracle/product/10.1.0/db_1/network/trace/listener.trc的跟踪信息
跟踪级别当前为0
以 pid=7180 开始
监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\.pipeEXTPROCipc)))
监听该对象时出错: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=pc-xxx.mail.yyy.cn)(PORT=1521)))
TNS-12542: TNS: 地址已被占用
TNS-12560: TNS: 协议适配器错误
TNS-00512: 地址已在使用
32-bit Windows Error: 48: Unknown error
不再监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\.pipeEXTPROCipc)))
2. Oracle的listener已经启动。
3. 查看oracle/product/10.1.0/db_1/NETWORK/ADMIN/listener.ora
# listener.ora Network Configuration File: D:/oracle/product/10.1.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:/oracle/product/10.1.0/db_1)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = pc-xxx.mail.yyy.cn)(PORT = 1521))
)
)
)
把(ADDRESS = (PROTOCOL = TCP)(HOST = pc-xxx.mail.yyy.cn)(PORT = 1521))
改为(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
pc-xxx.mail.yyy.cn是计算机名
127.0.0.1也就是目前数据库正在用的ip地址。
4. 查看oracle/product/10.1.0/db_1/NETWORK/ADMIN/tnsnames.ora
找到下列语句:
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = pc-xxx.mail.yyy.cn)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
将(ADDRESS = (PROTOCOL = TCP)(HOST = pc-xxx.mail.yyy.cn)(PORT = 1521))
改为(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
5. 关闭后再启动listener
运行->cmd启动dos窗口,执行lsnrctl stop关闭,lsnrctl start启动。
然后再重新利用PL/SQL Developer登录,就OK了。
这个是从网上看人家的解决方法,我也试了,并且成功了,但是当我再次打开listener.ora时候,发现127.0.0.1又变成原来的样子,因此我怀疑可能是因为重启了服务就可以了,所以以后有的童鞋也遇到这个问题了,不妨先重启下服务试下,如果不行,再试这个不迟。