欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

不同用户下使用tnsping+客户端服务名,结果不同

程序员文章站 2023-12-23 14:34:40
...

suse10sp2下安装oracle11g客户端,新建aipcti用户,tnsping vsm(vsm为客户端下服务名)失败,报错: TNS-03505: Failed to reso

问题描述;

SUSE10sp2下安装Oracle11g客户端,新建aipcti用户,tnsping vsm(vsm为客户端下服务名)失败,报错:
TNS-03505: Failed to resolve name ,Used parameter files:
/opt/oracle/product/11g/db/network/admin/sqlnet.ora。
而在oracle用户下直接执行此命令则没有问题。


问题处理:
1,使用aipcti用户直接tnsping +数据库IP则没有问题,但显示是通过
Used EZCONNECT adapter to resolve the alias 来解析的。

2,打开客户端下sqlnet.ora,里面有通过客户端访问数据库服务器顺序。可以看到该文件中访问顺序是先访问tnsnames,如果该文件下没有相关内容或访问失败,再通过EZCONNECT访问。

oracle@urp1vsmdb2:/opt/oracle/product/11g/db/network/admin> more sqlnet.ora
# sqlnet.ora Network Configuration File: /opt/oracle/product/11g/db/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

3,,显示tnsname.ora的权限:
oracle@urp1vsmdb2:/opt/oracle/product/11g/db/network/admin> ll -al tnsnames.ora
-rw-r----- 1 oracle oinstall 493 2011-09-23 16:09 tnsnames.ora

发现aipcti用户对该文件没有执行权限导致访问失败。
修改tnsnames.ora权限
oracle@urp1vsmdb2:/opt/oracle/product/11g/db/network/admin> chmod 644 tnsnames.ora
oracle@urp1vsmdb2:/opt/oracle/product/11g/db/network/admin> ls -al tnsnames.ora
-rw-r--r-- 1 oracle oinstall 493 2011-09-23 16:09 tnsnames.ora

4,修改后再次在aipcti下执行已经可以正常tnsping 客户端
/aipcti/icddir/bin>tnsping vsm

TNS Ping Utility for Linux: Version 11.1.0.7.0 - Production on 26-9?? -2011 14:38:04

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

Used parameter files:
/opt/oracle/product/11g/db/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.110.153.64)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = uivr)))
OK (0 msec)



以下为两种方式下输出结果对比:
1,aipcti用户下使用tnsping+数据库IP
/aipcti/icddir/bin>tnsping 10.110.153.64

TNS Ping Utility for Linux: Version 11.1.0.7.0 - Production on 26-9?? -2011 14:05:27

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

Used parameter files:
/opt/oracle/product/11g/db/network/admin/sqlnet.ora

Used EZCONNECT adapter to resolve the alias
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=))(ADDRESS=(PROTOCOL=TCP)(HOST=10.110.153.64)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)

(HOST=10.110.153.64)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=10.110.153.64)(PORT=1521)))
OK (0 msec)

2,aipcti用户下使用tnsping+服务名,正常的:
oracle@urp1vsmdb2:/opt/oracle/product/11g/db/network/admin> tnsping vsm

TNS Ping Utility for Linux: Version 11.1.0.7.0 - Production on 26-SEP-2011 14:28:37

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

Used parameter files:
/opt/oracle/product/11g/db/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.110.153.64)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = uivr)))
OK (10 msec)

不同用户下使用tnsping+客户端服务名,结果不同

上一篇:

下一篇: