ORA-12541: TNS: 无监听程序
C:UsersAdministrator>sqlplus sys/cape@orcl as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on 星期六 2月 18 12:55:46 2017
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR:
ORA-12541: TNS: 无监听程序
请输入用户名:
出现该问题是当前的监听服务没有启动:
C:UsersAdministrator>lsnrctl status
LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 18-2月 -2017 12:59:11
Copyright (c) 1991, 2010, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS: 无监听程序
TNS-12560: TNS: 协议适配器错误
TNS-00511: 无监听程序
64-bit Windows Error: 2: No such file or directory
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
TNS-12541: TNS: 无监听程序
TNS-12560: TNS: 协议适配器错误
TNS-00511: 无监听程序
64-bit Windows Error: 61: Unknown error
启动监听后:
C:UsersAdministrator>lsnrctl start
LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 18-2月 -2017 13:00:45
Copyright (c) 1991, 2010, Oracle. All rights reserved.
启动tnslsnr: 请稍候...
TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Production
系统参数文件为C:appDyjproduct11.2.0dbhome_1networkadminlistener.ora
写入c:appdyjdiagtnslsnrdongyjlisteneralertlog.xml的日志信息
监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\.pipeEXTPROC1521ipc)))
监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
LISTENER 的 STATUS
------------------------
别名 LISTENER
版本 TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Production
启动日期 18-2月 -2017 13:00:50
正常运行时间 0 天 0 小时 0 分 5 秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 C:appDyjproduct11.2.0dbhome_1networkadminlistener.ora
监听程序日志文件 c:appdyjdiagtnslsnrdongyjlisteneralertlog.xml
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\.pipeEXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
服务摘要..
服务 "CLRExtProc" 包含 1 个实例。
实例 "CLRExtProc", 状态 UNKNOWN, 包含此服务的 1 个处理程序...
命令执行成功
这里需要注意,此处的监听没有监听实例ORCL是因为监听晚于实例启动,没有把实例注册到监听中,Oracle的PMON进程每隔1分钟(60S)就会重新扫描实例,将实例注册到监听中,参考如下【Database SQL Language Reference】,
如果需要马上将实例注册到监听中,需要使用语句:
alter system register
Specify REGISTER to instruct the PMON background process to register the instance with the listeners immediately. If you do not specify this clause, then registration of the instance does not occur until the next time PMON executes the discovery routine. As a result, clients may not be able to access the services for as long as 60 seconds after the listener is started.
使用alter system register或者一分钟过后
C:UsersAdministrator>lsnrctl status
LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 18-2月 -2017 13:08:39
Copyright (c) 1991, 2010, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
LISTENER 的 STATUS
------------------------
别名 LISTENER
版本 TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Production
启动日期 18-2月 -2017 13:00:50
正常运行时间 0 天 0 小时 7 分 52 秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 C:appDyjproduct11.2.0dbhome_1networkadminlistener.ora
监听程序日志文件 c:appdyjdiagtnslsnrdongyjlisteneralertlog.xml
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\.pipeEXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
服务摘要..
服务 "CLRExtProc" 包含 1 个实例。
实例 "CLRExtProc", 状态 UNKNOWN, 包含此服务的 1 个处理程序...
服务 "orcl" 包含 1 个实例。
实例 "orcl", 状态 READY, 包含此服务的 1 个处理程序...
服务 "orclXDB" 包含 1 个实例。
实例 "orcl", 状态 READY, 包含此服务的 1 个处理程序...
命令执行成功
此时,重新连接数据库,数据库连接成功:
C:UsersAdministrator>sqlplus sys/cape@orcl as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on 星期六 2月 18 13:10:16 2017
Copyright (c) 1982, 2010, Oracle. All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
在windows,也可以通过在服务中,启动监听,而不需要通过命令重新启动;
2. ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务
先检查监听的监控状况:
C:UsersAdministrator>lsnrctl status
LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 18-2月 -2017 13:21:36
Copyright (c) 1991, 2010, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
LISTENER 的 STATUS
------------------------
别名 LISTENER
版本 TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Production
启动日期 18-2月 -2017 13:14:41
正常运行时间 0 天 0 小时 6 分 58 秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 C:appDyjproduct11.2.0dbhome_1networkadminlistener.ora
监听程序日志文件 c:appdyjdiagtnslsnrdongyjlisteneralertlog.xml
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\.pipeEXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
服务摘要..
服务 "CLRExtProc" 包含 1 个实例。
实例 "CLRExtProc", 状态 UNKNOWN, 包含此服务的 1 个处理程序...
命令执行成功
查看服务窗口下的实例服务是否启动:
启动后,检查监听:
ORA-12560: TNS: 协议适配器错误
C:UsersAdministrator>sqlplus sys/cape as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on 星期六 2月 18 13:27:40 2017
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR:
ORA-12560: TNS: 协议适配器错误
请输入用户名:
请注意上方的数据库连接方式:
sqlplus sys/cape as sysdba(在cape单词后面没有@orcl连接符),此时是不需要请求监听文件的,遇到该问题,则是因为数据库实例没有启动,导致无法连接数据库
下面是加了@orcl连接符的情况
C:UsersAdministrator>sqlplus sys/cape@orcl as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on 星期六 2月 18 13:30:42 2017
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务
请输入用户名:
查看监听,该实例也未监控;
C:UsersAdministrator>lsnrctl status
LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 18-2月 -2017 13:31:25
Copyright (c) 1991, 2010, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
LISTENER 的 STATUS
------------------------
别名 LISTENER
版本 TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Production
启动日期 18-2月 -2017 13:14:41
正常运行时间 0 天 0 小时 16 分 47 秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 C:appDyjproduct11.2.0dbhome_1networkadminlistener.ora
监听程序日志文件 c:appdyjdiagtnslsnrdongyjlisteneralertlog.xml
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\.pipeEXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
服务摘要..
服务 "CLRExtProc" 包含 1 个实例。
实例 "CLRExtProc", 状态 UNKNOWN, 包含此服务的 1 个处理程序...
命令执行成功
重启启动实例后,监听监控到了实例
C:UsersAdministrator>lsnrctl status
LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 18-2月 -2017 13:32:06
Copyright (c) 1991, 2010, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
LISTENER 的 STATUS
------------------------
别名 LISTENER
版本 TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Production
启动日期 18-2月 -2017 13:14:41
正常运行时间 0 天 0 小时 17 分 28 秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 C:appDyjproduct11.2.0dbhome_1networkadminlistener.ora
监听程序日志文件 c:appdyjdiagtnslsnrdongyjlisteneralertlog.xml
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\.pipeEXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
服务摘要..
服务 "CLRExtProc" 包含 1 个实例。
实例 "CLRExtProc", 状态 UNKNOWN, 包含此服务的 1 个处理程序...
服务 "orcl" 包含 1 个实例。
实例 "orcl", 状态 READY, 包含此服务的 1 个处理程序...
服务 "orclXDB" 包含 1 个实例。
实例 "orcl", 状态 READY, 包含此服务的 1 个处理程序...
命令执行成功