I had an interesting question today.
Oracle users can tnsping, ordinary users tnsping error
When you tnsping a database with a regular user
tns-03505:failed to resolve name
and tnsping the database with an Oracle user, you can ping it.
<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 contacts (DESCRIPTION = (address = (PROTOCOL = TCP) (HOST = 192.168.0.39) (PORT = 1521)) (Connect_data = (SERVE R = dedicated) (service_name = orarpt)))
OK (0 msec)
What's the reason for that, check the Tnsnames.ora and find out?
oracle@linux-sit:~/product/11.1.0/db_1/network/admin> more Tnsnames.ora
More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/database/Oracle/
# 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)
)
)
Check the file permissions and find the problem here, Tnsnames.ora permissions are problematic
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
Try to modify chmod 755 Tnsnames.ora
Then use ordinary user tnsping, problem solving
<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 contacts (DESCRIPTION = (address = (PROTOCOL = TCP) (HOST = 192.168.0.39) (PORT = 1521)) (Connect_data = (SERVE R = dedicated) (service_name = orarpt)))
OK (0 msec)
This article is from "Richard's notes-accumulate micro Cheng" blog, please be sure to keep this source http://zxf261.blog.51cto.com/701797/750308