關於TNS_ADMIN環境變量


這里我補充一句:TNS_ADMIN正常是寫客戶端的路徑(但是很奇怪,我改成服務端的居然也不影響訪問,我服務端客戶端都在本地)

很多oracle產品都有自己的TNS文件,如果你的系統里裝了多個Oracle的產品的話,那么客戶端連instance的時候,到底是使用那個tnsnames.ora呢?這個時候就需要看TNS_ADMIN這個參數了。

Question: What is the tns_admin parameter and how do I use tns_admin to define a common location for my TNS files?

Answer:  The tns_admin parameter determines the location of the tns administration files (e.g. tnsnames.ora and listener.ora, etc.) 
The tns_admin parameter is super useful on servers with many databases on different release levels (hence different $ORACLE_HOME directories) because all databases tns_admin values can be set to a single location, allowing a single set of SQL*Net files for all databases on the server. 

Without the tns_admin variable, each instance would have it's own set of TNS files in the $ORACLE_HOME/network/admin directory.


查看方法:命令行
C:\Documents and Settings\ptian>set TNS_ADMIN
TNS_ADMIN=D:\oracle\product\10.1.0\Db_1\NETWORK\ADMIN
這就表示客戶端會從D:\oracle\product\10.1.0\Db_1\NETWORK\ADMIN下讀取TNS的設置

修改方法:
有兩個地方可以修改,一個是注冊表,一個是系統環境變量。
注冊表的位置:HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOME0\TNS_ADMIN
系統環境變量的優先級高於注冊表,如果設置了環境變量,那么就會忽略注冊表的值。

轉載自:https://blog.csdn.net/pan_tian/article/details/7699599/


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM