【轉】ORACLE TNSING報錯(TNS-03505)的解決
一大早來上班,就有同事告訴我某省的資料庫監聽有問題。趕快檢查了一下,發現其實是前端主機重啟後沒有啟動完全應用造成了一些錯誤和資料庫監聽沒有關係的。
至於為什麼同事會懷疑到資料庫監聽我也感到很怪異。
檢查沒有問題後,還是不放心,於是就利用tnsping進行測試:
顯然sqlnet.ora檔案中的連線控制引數有些問題,檢查下:
引數NAMES.DIRECTORY_PATH只有一個TNSNAMES,看看官方文件的介紹:
應該有六個引數的,於是增加一個hostname引數。再次進行連線即告成功。
BTW:
其實這個引數的default值Default
NAMES.DIRECTORY_PATH=(tnsnames, onames, hostname)
應經可以滿足基本的要求了。-:)
至於為什麼同事會懷疑到資料庫監聽我也感到很怪異。
檢查沒有問題後,還是不放心,於是就利用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
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)
# 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.
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)
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)
應經可以滿足基本的要求了。-:)
我只是加了一個hostname,沒有加onames
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/2317695/viewspace-759004/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- SS報錯的解決
- ORA-12154 和 TNS-03505 監聽錯誤的解決方法
- Oracle10g 報錯'java.lang.Exception: No such metric'的解決方法[轉載]OracleJavaException
- oracle 10g emctl 報錯的解決辦法Oracle 10g
- CentOS 6安裝Oracle報錯解決方案CentOSOracle
- oracle錯誤及解決方式集(轉)Oracle
- ldap增加資訊報錯,請高手解決!(轉)LDA
- mybatis報錯解決MyBatis
- Oracle 條件索引 case when 報錯解決方案Oracle索引
- LINUX 按裝ORACLE 9204 報錯解決!!LinuxOracle
- 轉發 安裝 scount 的 es 驅動,報錯解決
- 幾個報錯的解決方法
- ORACLE常見錯誤程式碼的分析與解決(轉)Oracle
- 解決fitz模組報錯
- 解決eslint報錯EsLint
- iText中文,報錯解決
- Oracle10g 報錯'java.lang.Exception: No such metric'的解決方法OracleJavaException
- EM的報錯解決:oracle.sysman.gcagent.target.……ConfigStateMgr:798OracleGC
- Qt報Multiple definition錯誤的解決QT
- ora-27140報錯的解決
- git報錯400的解決辦法Git
- 【ASK_ORACLE】Oracle RAC報錯“ipc send timeout”的原因以及解決辦法Oracle
- Oracle資料庫配置錯誤資訊解決方法(轉)Oracle資料庫
- hive使用報錯解決方法Hive
- npm install 報錯解決NPM
- supervisor使用報錯解決
- Windows分割槽報錯解決Windows
- 水煮oracle24---- oracle em 啟動報錯 相關問題解決Oracle
- Oracle的TNS-12502錯誤原因及解決(轉)Oracle
- dbfread報錯ValueError錯誤解決方法Error
- ORACLE ORA-15025 ORA-27041 報錯解決方法Oracle
- Oracle ORA - 01720 grant option does not exist for..報錯解決Oracle
- VUE—刪除HelloWorld.vue後報錯 `--fix` option報錯的解決Vue
- Django(21)migrate報錯的解決方案Django
- 解決eclipse的maven依賴報錯EclipseMaven
- ORA-01756報錯的解決方案
- ***XAMPP:報錯Unabletoloaddynamiclibrary的解決方法
- 設定autotrace的報錯問題解決