tnsping报TNS-12541: TNS:no listener

案例:
在windows的oracle实例orcl中可以正常添加linux中oracle的dblink
在linux中编辑tnsnames.ora后无法tnsping通windows中的实例orcl

[oracle@rac1 admin]$ tnsping orcl

TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 04-FEB-2015 21:25:01

Copyright (c) 1997, 2013, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = orcl)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl.digitalchina.com)))
TNS-12541: TNS:no listener

报错内容显示在windwos服务端中没有监听程序
此时检查windows端的监听程序显示正常

C:\Users\zhaixya>lsnrctl status

LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 01-3月 -2015 13:06:57

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
启动日期                  01-3月 -2015 11:37:19
正常运行时间              01 小时 2942 秒
跟踪级别                  off
安全性                    ON: Local OS Authentication
SNMP                      OFF
监听程序参数文件          D:\app\zhaixya\product\11.2.0\dbhome_1\network\admin\listener.ora
监听程序日志文件          d:\app\zhaixya\diag\tnslsnr\ZHAIXYA-3\listener\alert\log.xml
监听端点概要...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
服务摘要..
服务 "CLRExtProc" 包含 1 个实例。
  实例 "CLRExtProc", 状态 UNKNOWN, 包含此服务的 1 个处理程序...
服务 "orcl.digitalchina.com" 包含 1 个实例。
  实例 "orcl", 状态 READY, 包含此服务的 1 个处理程序...
服务 "orclXDB.digitalchina.com" 包含 1 个实例。
  实例 "orcl", 状态 READY, 包含此服务的 1 个处理程序...
命令执行成功

起初怀疑是在客户端中tnsnames.ora中存在错误,将ip地址更换为主机名且添加入hosts文件无效。
然后怀疑是在sqlnet.ora文件中

SQLNET.AUTHENTICATION_SERVICES= (NONE)

更换nts,none都无效。

解决方法


在客户端监听启动过程中使用的文件 D:\app\zhaixya\product\11.2.0\dbhome_1\network\admin\listener.ora
不存在和linux中客户端tnsnames中记录的ip地址。
在listener.ora中加入一行

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.120)(PORT = 1521))

问题解决

[oracle@rac1 admin]$ tnsping orcl

TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 04-FEB-2015 21:25:01

Copyright (c) 1997, 2013, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = orcl)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl.digitalchina.com)))
TNS-12541: TNS:no listener
[oracle@rac1 admin]$ tnsping orcl

TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 04-FEB-2015 21:27:28

Copyright (c) 1997, 2013, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = orcl)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl.digitalchina.com)))
OK (20 msec)

你可能感兴趣的:(oracle11g)