TNS-03505 oracle用户可以tnsping通,普通用户tnsping报错

From: http://zxf261.blog.51cto.com/701797/750308

今天碰到了一个有趣的问题
oracle用户可以tnsping通,普通用户tnsping报错
用普通用户tnsping数据库的时候报
TNS-03505: Failed to resolve name
而用oracle用户tnsping数据库的时候却可以ping通


<34 linux-sit:/home/smsds>tnsping orarpt

TNS Ping Utility for Linux: Version 11.1.0.6.0 - Production on 24-DEC-2011 15:33:18

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

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

TNS-03505: Failed to resolve name


oracle@linux-sit:~/product/11.1.0/db_1/network/admin> tnsping orarpt

TNS Ping Utility for Linux: Version 11.1.0.6.0 - Production on 24-DEC-2011 15:35:42

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

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


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.39)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orarpt)))
OK (0 msec)


到底是什么原因呢,查看了tnsnames.ora发现也没问题

oracle@linux-sit:~/product/11.1.0/db_1/network/admin> more tnsnames.ora
# tnsnames.ora Network Configuration File: /home/oracle/product/11.1.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

orarpt =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.39)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orarpt)
    )
  )
 
查看下文件权限,发现问题在这,tnsnames.ora的权限有问题
oracle@linux-sit:~/product/11.1.0/db_1/network/admin> ll
total 16
-rw-r--r-- 1 oracle oinstall 335 2011-12-22 15:58 listener.ora
drwxr-xr-x 2 oracle oinstall 144 2011-12-22 15:18 samples
-rw-r--r-- 1 oracle oinstall 187 2007-05-07 23:03 shrept.lst
-rw-r--r-- 1 oracle oinstall 188 2011-12-22 15:58 sqlnet.ora
-rw-r----- 1 oracle oinstall 328 2011-12-24 15:21 tnsnames.ora


修改试试chmod 644 tnsnames.ora(将tnsnames.ora的权限改成其他用户可以)

再用普通用户tnsping一下,问题解决
<34 linux-sit:/home/smsds>tnsping orarpt

TNS Ping Utility for Linux: Version 11.1.0.6.0 - Production on 24-DEC-2011 17:11:50

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

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


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.39)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orarpt)))
OK (0 msec)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值