問題描述;
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 用戶端
</home/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
</home/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)