数据库突然连接不上了,报出问题是ORA-12514:监听程序当前无法识别连接描述服务中请求的服务,于是请教老师,老师在网路上找到这篇帖子解决了我的问题。
系统环境:Oracle 11.2.0.1.0 R2
下面操作默认在安装Oralce数据库的服务器上运行。
1)确保Oracle 基本服务都已启动
OracleDBConsoleorcl
OracleOraDb11g_home1TNSListener
OracleServiceORCL
2)打开命令行,使用 sqlplus nokia_user/oracle@202.206.0.233/orcl 命令登录 oracle ,显示如下:
C:Documents and SettingsAdministrator>sqlplus nokia_user/oracle@202.206.0.233/orcl
SQL*Plus: Release 11.2.0.1.0 Production on 星期五 12月 23 10:37:52 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR:
ORA-12541: TNS: 无监听程序
在ORA-12541: TNS: 无监听程序 错误下,无论是否在本地登录都是会提示ORA-12541: TNS: 无监听程序错误的
3)在命令行中,执行lsnrctl status
C:Documents and SettingsAdministrator>lsnrctl status
LSNRCTL for 32-bit Windows: Version 11.2.0.1.0 - Production on 23-12月-2011 09:27:35
Copyright (c) 1991, 2010, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
LISTENER 的 STATUS
------------------------
别名 LISTENER
版本 TNSLSNR for 32-bit Windows: Version 11.2.0.1.0 - Production
启动日期 23-12月-2011 09:17:19
正常运行时间 0 天 0 小时 10 分 16 秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 C:Program_FilesOracleDataBase_11G_R2product11.2.0dbhome_1
etworkadminlistener.ora
监听程序日志文件 c:program_filesoracledatabase_11g_r2diag nslsnrdbserver-7ec4a9listeneralertlog.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 个处理程序...
命令执行成功
在这里可以看到监听程序参数文件的位置
4)修改监听程序参数文件
初次打开时,内容如下
# listener.ora Network Configuration File: C:Program_FilesOracleDataBase_11G_R2product11.2.0dbhome_1
etworkadminlistener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:Program_FilesOracleDataBase_11G_R2product11.2.0dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:Program_FilesOracleDataBase_11G_R2product11.2.0dbhome_1inoraclr11.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST =localhost)(PORT = 1521))
)
)
ADR_BASE_LISTENER = C:Program_FilesOracleDataBase_11G_R2
修改为:
# listener.ora Network Configuration File: C:Program_FilesOracleDataBase_11G_R2product11.2.0dbhome_1
etworkadminlistener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = orcl)
(ORACLE_HOME = C:Program_FilesOracleDataBase_11G_R2product11.2.0dbhome_1)
#(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:Program_FilesOracleDataBase_11G_R2product11.2.0dbhome_1inoraclr11.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = orcl))
(ADDRESS = (PROTOCOL = TCP)(HOST =202.206.0.233)(PORT = 1521))
)
)
ADR_BASE_LISTENER = C:Program_FilesOracleDataBase_11G_R2
SID_NAME,KEY 的值修改为要访问的oracle实例的名称,HOST 修为 oracle 服务器使用的地址
5)重启listener,在命令行中依次执行 lsnrctl stop,lsnrctl start
C:Documents and SettingsAdministrator>lsnrctl stop
LSNRCTL for 32-bit Windows: Version 11.2.0.1.0 - Production on 23-12月-2011 09:46:17
Copyright (c) 1991, 2010, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=orcl)))
TNS-12541: TNS: 无监听程序
TNS-12560: TNS: 协议适配器错误
TNS-00511: 无监听程序
32-bit Windows Error: 2: No such file or directory
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=202.206.0.233)(PORT=1521)))
命令执行成功
C:Documents and SettingsAdministrator>lsnrctl start
LSNRCTL for 32-bit Windows: Version 11.2.0.1.0 - Production on 23-12月-2011 09:46:31
Copyright (c) 1991, 2010, Oracle. All rights reserved.
启动tnslsnr: 请稍候...
TNSLSNR for 32-bit Windows: Version 11.2.0.1.0 - Production
系统参数文件为C:Program_FilesOracleDataBase_11G_R2product11.2.0dbhome_1
etworkadminlistener.ora
写入c:program_filesoracledatabase_11g_r2diag nslsnrdbserver-7ec4a9listeneralertlog.xml的日志信息
监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\.pipeorclipc)))
监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=202.206.0.233)(PORT=1521)))
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=orcl)))
LISTENER 的 STATUS
------------------------
别名 LISTENER
版本 TNSLSNR for 32-bit Windows: Version 11.2.0.1.0 - Production
启动日期 23-12月-2011 09:46:34
正常运行时间 0 天 0 小时 0 分 3 秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 C:Program_FilesOracleDataBase_11G_R2product11.2.0dbhome_1
etworkadminlistener.ora
监听程序日志文件 c:program_filesoracledatabase_11g_r2diag nslsnrdbserver-7ec4a9listeneralertlog.xml
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\.pipeorclipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=202.206.0.233)(PORT=1521)))
服务摘要..
服务 "orcl" 包含 1 个实例。
实例 "orcl", 状态 UNKNOWN, 包含此服务的 1 个处理程序...
命令执行成功
6)查看状态 lsnrctl start
C:Documents and SettingsAdministrator>lsnrctl start
LSNRCTL for 32-bit Windows: Version 11.2.0.1.0 - Production on 23-12月-2011 09:46:31
Copyright (c) 1991, 2010, Oracle. All rights reserved.
启动tnslsnr: 请稍候...
TNSLSNR for 32-bit Windows: Version 11.2.0.1.0 - Production
系统参数文件为C:Program_FilesOracleDataBase_11G_R2product11.2.0dbhome_1
etworkadminlistener.ora
写入c:program_filesoracledatabase_11g_r2diag nslsnrdbserver-7ec4a9listeneralertlog.xml的日志信息
监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\.pipeorclipc)))
监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=202.206.0.233)(PORT=1521)))
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=orcl)))
LISTENER 的 STATUS
------------------------
别名 LISTENER
版本 TNSLSNR for 32-bit Windows: Version 11.2.0.1.0 - Production
启动日期 23-12月-2011 09:46:34
正常运行时间 0 天 0 小时 0 分 3 秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 C:Program_FilesOracleDataBase_11G_R2product11.2.0dbhome_1
etworkadminlistener.ora
监听程序日志文件 c:program_filesoracledatabase_11g_r2diag nslsnrdbserver-7ec4a9listeneralertlog.xml
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\.pipeorclipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=202.206.0.233)(PORT=1521)))
服务摘要..
服务 "orcl" 包含 1 个实例。
实例 "orcl", 状态 UNKNOWN, 包含此服务的 1 个处理程序...
命令执行成功
7)再次登录 sqlplus nokia_user/oracle@202.206.0.233/orcl
C:Documents and SettingsAdministrator>sqlplus nokia_user/oracle@202.206.0.233/orcl
SQL*Plus: Release 11.2.0.1.0 Production on 星期五 12月 23 11:06:28 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
出现上面信息说明登录成功