扩大
缩小

ORA-12154:TNS:无法解析指定的连接标识符

问题:ORA-12154:TNS:无法解析指定的连接标识符

截图如下:

我的解决步骤如下:

1)查看监听状态lsnrctl status ,如果没有启动的话,使用lsnrctl start启动

C:\Users\Administrator>lsnrctl status

LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 11-8月 -2017 11
8:08

Copyright (c) 1991, 2010, Oracle.  All rights reserved.

正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.2.30)(PORT=1521))
LISTENER 的 STATUS
------------------------
别名                      LISTENER
版本                      TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Pro
ction
启动日期                  11-8月 -2017 11:45:20
正常运行时间              00 小时 248 秒
跟踪级别                  off
安全性                    ON: Local OS Authentication
SNMP                      OFF
监听程序参数文件          E:\app\Administrator\product\11.2.0\dbhome_64\networ
admin\listener.ora
监听程序日志文件          e:\app\administrator\diag\tnslsnr\WIN-69CON556EF4\li
ener\alert\log.xml
监听端点概要...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.2.30)(PORT=1521)))
服务摘要..
服务 "CLRExtProc" 包含 1 个实例。
  实例 "CLRExtProc", 状态 UNKNOWN, 包含此服务的 1 个处理程序...
命令执行成功

2)打开监听的位置文件

 监听的位置可以从上面的命令中找到 E:\app\Administrator\product\11.2.0\dbhome_64\networ admin\listener.ora

 

# listener.ora Network Configuration File: E:\app\Administrator\product\11.2.0\dbhome_64\network\admin\listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
   (SID_DESC =
      (SID_NAME = orcl)
      (GLOBALDB_NAME=ORCL)
      (ORACLE_HOME = E:\app\Administrator\product\11.2.0\dbhome_64)
    )
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = E:\app\Administrator\product\11.2.0\dbhome_64)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:E:\app\Administrator\product\11.2.0\dbhome_64\bin\oraclr11.dll")
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.30)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = E:\app\Administrator

 

上面红色的部分是添加的。

3)重启监听程序

C:\Users\Administrator>lsnrctl stop

LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 11-8月 -2017 11:5
1:41

Copyright (c) 1991, 2010, Oracle.  All rights reserved.

正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.2.30)(PORT=1521)))
命令执行成功

C:\Users\Administrator>lsnrctl start

LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 11-8月 -2017 11:5
1:50

Copyright (c) 1991, 2010, Oracle.  All rights reserved.

启动tnslsnr: 请稍候...

TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Production
系统参数文件为E:\app\Administrator\product\11.2.0\dbhome_64\network\admin\listen
er.ora
写入e:\app\administrator\diag\tnslsnr\WIN-69CON556EF4\listener\alert\log.xml的日
志信息
监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.2.30)(PORT=1521)))

正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.2.30)(PORT=1521)))
LISTENER 的 STATUS
------------------------
别名                      LISTENER
版本                      TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Produ
ction
启动日期                  11-8月 -2017 11:51:56
正常运行时间              00 小时 05 秒
跟踪级别                  off
安全性                    ON: Local OS Authentication
SNMP                      OFF
监听程序参数文件          E:\app\Administrator\product\11.2.0\dbhome_64\network\
admin\listener.ora
监听程序日志文件          e:\app\administrator\diag\tnslsnr\WIN-69CON556EF4\list
ener\alert\log.xml
监听端点概要...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.2.30)(PORT=1521)))
服务摘要..
服务 "CLRExtProc" 包含 1 个实例。
  实例 "CLRExtProc", 状态 UNKNOWN, 包含此服务的 1 个处理程序...
服务 "orcl" 包含 1 个实例。
  实例 "orcl", 状态 UNKNOWN, 包含此服务的 1 个处理程序...
命令执行成功

出现这个说明了监听了orcl实例。

4)再次连接

sqlplus 测试:

C:\Users\Administrator>E:\app\Administrator\product\11.2.0\client_32\BIN\sqlplus
 system/manager@orcl

SQL*Plus: Release 11.2.0.1.0 Production on 星期五 8月 11 11:57:06 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

plsql测试:

如果还是有错误,请确保你的plsql软件的配置是否正确。

 

posted on 2017-08-11 12:03  LinuxPanda  阅读(3864)  评论(0编辑  收藏  举报

导航