ORA-12154: TNS: 无法解析指定的连接标识符windows7 32bit+oracle 11g数据库服务和侦听器服务已经启动:
lsnrctl status的输出如下:
LSNRCTL for 32-bit Windows: Version 11.2.0.1.0 - Production on 15-12月-2011 11:0
7:57
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 - Produ
ction
启动日期 15-12月-2011 10:45:29
正常运行时间 0 天 0 小时 22 分 28 秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 C:\oracle\product\11.2.0\dbhome_1\network\admin\listen
er.ora
监听程序日志文件 c:\oracle\diag\tnslsnr\ad999\listener\alert\log.xml
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ad999)(PORT=1521)))
服务摘要..
服务 "CLRExtProc" 包含 1 个实例。
实例 "CLRExtProc", 状态 UNKNOWN, 包含此服务的 1 个处理程序...
服务 "orcl" 包含 1 个实例。
实例 "orcl", 状态 READY, 包含此服务的 1 个处理程序...
服务 "orclXDB" 包含 1 个实例。
实例 "orcl", 状态 READY, 包含此服务的 1 个处理程序...
命令执行成功
sqlnet.ora文件如下:
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
listener.ora文件如下:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\oracle\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\oracle\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = AD999)(PORT = 1521))
)
)
ADR_BASE_LISTENER = C:\oracle
tnsnames.ora文件如下:
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = AD999)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORCL)
)
)
tnsping测试正常:
TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 15-12月-
2011 11:11:23
Copyright (c) 1997, 2010, Oracle. All rights reserved.
已使用的参数文件:
C:\oracle\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
已使用 TNSNAMES 适配器来解析别名
尝试连接 (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = AD999
)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = ORCL)))
OK (30 毫秒)
但无法用scott用户登录:C:\Users\ask>sqlplus scott/1111111@orcl
SQL*Plus: Release 11.2.0.1.0 Production on 星期四 12月 15 11:11:42 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR:
ORA-12154: TNS: 无法解析指定的连接标识符
请输入用户名:
scott用户经测试能正常登录查询:SQL> conn scott/1111111
已连接。
SQL> select * from dept;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON