some error of the Oracle connection TNS-03505 OR TNS-12541(原创)

类别:数据库 点击:0 评论:0 推荐:

(原创)配置tnsname是个十分容易的问题,没什么好说的,以前也从来没有错过,不过今天配置的时候出了两个小问题(这两个问题是用GUI配置时不会出的,我觉得Java启动太慢,手工配置tnsname.ora时出现的)
C:\>tnsping 100

TNS Ping Utility for 32-bit Windows: Version 9.2.0.1.0 - Production on 15-OCT-2004 12:38:38

Copyright (c) 1997 Oracle Corporation.  All rights reserved.

Used parameter files:
F:\oracle\ora92\network\admin\sqlnet.ora

Used HOSTNAME adapter to resolve the alias
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SID=*)(SERVICE_NAME=100))(ADDRESS=(PROTOCOL=TCP)(HOST=100)(PORT=1521)))
TNS-12541: TNS:no listener
查看Server端的监听,lsnrctl status,结果正常

查看tnsname.ora
 100 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.6.100)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = oracas)
    )
  )

完全正确....
*******************************************************************
 或者是
C:\>tnsping 226

TNS Ping Utility for 32-bit Windows: Version 9.2.0.1.0 - Production on 15-OCT-2004 12:40:12

Copyright (c) 1997 Oracle Corporation.  All rights reserved.

Used parameter files:
F:\oracle\ora92\network\admin\sqlnet.ora

TNS-03505: Failed to resolve name(意思是不存在226在文件tnsname.ora中)
查看tnsname.ora
226 =  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.6.226)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = oracas)
    )
  )
完全正确...

最后分析出导致上述两个问题的原因都是应为tns前面多了一个空格。。。。。。寒,居然是这种错误...
所以大家配置的时候小心细节问题

本文地址:http://com.8s8s.com/it/it20250.htm