ORA-12154: TNS:could not resolve service name / TNS-03505: Failed to resolve name
一個新建立的資料庫,連線不上提示如下錯誤:
$ sqlplus
SQL*Plus: Release 9.2.0.1.0 - Production on Mon Feb 23 21:53:35 2009
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
ERROR:
ORA-12154: TNS:could not resolve service name
用tnsping檢測:
$ tnsping tt9a
TNS Ping Utility for IBM/AIX RISC System/6000: Version 9.2.0.1.0 - Production on 23-FEB-2009 21:52:59
Copyright (c) 1997 Oracle Corporation. All rights reserved.
Used parameter files:
/xxx/oraxxx/db/tech_st/10.2.0/network/admin/xxx/sqlnet_ifile.ora
TNS-03505: Failed to resolve name
$
怎麼會有
Used parameter files:
/xxx/oraxxx/db/tech_st/10.2.0/network/admin/xxx/sqlnet_ifile.ora
------------------------------------------------
檢查環境變數,居然有TNS_ADMIN:
TNS_ADMIN=/xxx/oraxxx/db/tech_st/10.2.0/network/admin/xxx
但當前Oracle 使用者並沒有設定TNS_ADMIN
--------------------
解決方法一(值標):嘗試設定一個新的值替換掉原來的TNS_ADMIN定義:
TNS_ADMIN=/u01/ora9a/product/9.2/network/admin;export TNS_ADMIN
解決方法二(值本):
找到什麼地方設定了這個TNS_ADMIN,在root使用者下,
# env|grep TNS_ADMIN
TNS_ADMIN=/xxx/oraxxx/db/tech_st/10.2.0/network/admin/xxx
發現有這個配置,尋找root使用者的相關環境變數/etc/profile及/.profile都沒有發現這個配置,一般地,系統的環境變數就在這兩個位置,怎麼沒有?
到/etc/下find 這個TNS_ADMIN
發現還有一個檔案/etc/environment中有這個配置,後來找相關資料查證了下,AIX下讀取環境變數的順序是/etc/profile-->/etc/environment--->使用者的 profile-->使用者的.env(如果使用者的profile中有設定ENV=$HOME/.env)
以前還沒有遇到這樣的情況,留下吧,方便!
[@more@]來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15385/viewspace-1017770/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ORA-12154: TNS:could not resolve the connect identifier specifiedIDE
- ORA-12154: TNS: could not resolve the connect identifier specifiedIDE
- Oracle案例09——ORA-12154: TNS:could not resolve the connect identifier specifiedOracleIDE
- Oracle 10g ORA-12154: TNS: could not resolve the connect identifier specifiedOracle 10gIDE
- 【DataGuard】 TNS:could not resolve the connect identifier specifiedIDE
- 關於ORA-12154: TNS:could not resolve the connect identifier specified的問題IDE
- EF:Oracle.DataAccess.Client.OracleException: ORA-12154: TNS:could not resolve the connect identifier specifiedOracleclientExceptionIDE
- django rest django.core.exceptions.ImproperlyConfigured: Could not resolve URL for hyperlinked relationship using view nameDjangoRESTExceptionView
- DB_NAME&TANCE_NAME&DB_UNIQUE_NAME&ORACLE_SID&GLOBAL_NAME&DB_DOMAIN&SERVICE_NAMEOracleAI
- CUUG 筆記ORACLE db_name instance_name gobal_name service_name db_unique_name分析筆記OracleGo
- DB_NAME、DB_UNIQUE_NAME、SERVICE_NAME和INSTANCE_NAME等的區別
- db_name,db_domain, global_name, service_name的區別AI
- Oracle案例05——ORA-12162: TNS:net service name is incorrectly specifiedOracle
- 【故障處理】ORA-12162: TNS:net service name is incorrectly specified
- Oracle修改instance_name、db_name、db_unique_name、service_namesOracle
- INS-40904 ORACLE_HOSTNAME Does not Resolve to a Valid Host Name [ID 1281039.1]Oracle
- ERROR: Failed to resolve: org.greenrobot:eventbus:2.4.0ErrorAI
- Oracle SID VS Service NameOracle
- Oracle SID & SERVICE_NAMEOracle
- mysql啟用skip-name-resolve模式時出現Warning的處理辦法MySql模式
- ora-12169 tns net service name given as connect identifier is too longIDE
- Could not resolve host: 'localhost 報錯解決辦法localhost
- 關於Failed to resolve的問題解決AI
- AndroidStudio升級報錯Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve cAndroidAPPCompile
- 關於service_name,instance_name的結論性理解
- 徹底理解初始化引數SERVICE_NAMES和客戶端TNS中SERVICE_NAME(2)客戶端
- 徹底理解初始化引數SERVICE_NAMES和客戶端TNS中SERVICE_NAME(1)客戶端
- [轉]ORACLE中的DB_NAME,SERVICE_NAME,INSTANCE_NAME,ORACLE_SID,GLOBAL_DBNAMEOracle
- ORACL中的DB_NAME,SERVICE_NAME,INSTANCE_NAME,ORACLE_SID,GLOBAL_DBNAME介紹Oracle
- ORACLE中的DB_NAME,SERVICE_NAME,INSTANCE_NAME,ORACLE_SID,GLOBAL_DBNAME介紹Oracle
- dataguard 更換IP,service_name(二)
- ORA-12154 和 TNS-03505 監聽錯誤的解決方法
- 【Oracle】service_name和service_names的關係Oracle
- 異常org.hibernate.QueryException: could not resolve property的原因Exception
- oracle 11g登陸報錯'ORA-12162: TNS:net service name is incorrectly specified'Oracle
- hpux上的定時任務報:ORA-12162: TNS:net service name is incorrectly specifiedUX
- oracle中service_name區別總結Oracle
- RMAN 6217 not connected to auxiliary database with a net service nameUXDatabase