ORACLE TNSING报错(TNS-03505)的解决

        一大早来上班,就有同事告诉我某省的数据库监听有问题。赶快检查了一下,发现其实是前端主机重启后没有启动完全应用造成了一些错误和数据库监听没有关系的。
         至于为什么同事会怀疑到数据库监听我也感到很怪异。
         检查没有问题后,还是不放心,于是就利用tnsping进行测试:
       
[oracle@localhost ~]$ tnsping 211.1XX.XX.XX

TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 10-DEC-2008 09:45:50

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

Used parameter files:
/home/oracle/product/10.2/network/admin/sqlnet.ora

TNS-03505: Failed to resolve name

      显然sqlnet.ora文件中的连接控制参数有些问题,检查下:

[oracle@localhost ~]$ more /home/oracle/product/10.2/network/admin/sqlnet.ora
# sqlnet.ora Network Configuration File: /home/oracle/product/10.2/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.

NAMES.DIRECTORY_PATH= (TNSNAMES)

#SQLNET.AUTHENTICATION_SERVICES= (NTS)

#NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

        参数NAMES.DIRECTORY_PATH只有一个TNSNAMES,看看官方文档的介绍:
tnsnames:local naming naming method
Set to resolve a net service name through the tnsnames.ora file on the client.


ldap:directory naming naming method
Set to resolve a database service name, net service name, or net service alias through a directory server.


onames:Oracle Names method
Set to resolve database objects through a Oracle Names server.


hostname:host naming method
Set to resolve a host name alias through an existing names resolution service or a centrally-maintained set of /etc/hosts files.


cds:Cell Directory Services (CDS) external naming method
Set to resolve an Oracle database name in a Distributed Computing Environment (DCE) environment.


nis:Network Information Service (NIS) external naming method
Set to resolve service information through an existing NIS.
       
        应该有六个参数的,于是增加一个hostname参数。再次进行连接即告成功。
[oracle@localhost ~]$ tnsping 2XX.1XX.2XX.XX

TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 10-DEC-2008 09:56:52

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

Used parameter files:
/home/oracle/product/10.2/network/admin/sqlnet.ora

Used HOSTNAME adapter to resolve the alias
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=211.139.222.155))(ADDRESS=(PROTOCOL=TCP)(HOST=211.139.222.155)(PORT=1521)))
OK (70 msec)

        BTW:

      其实这个参数的default值Default
      NAMES.DIRECTORY_PATH=(tnsnames, onames, hostname)

        应经可以满足基本的要求了。-:)



你可能感兴趣的:(oracle,职场,休闲,tns-03505,TNSING)