Kiran Dalvi
- 12 Sep, 2023
- 0 Comments
- 1 Min Read
TNS_ADMIN Environment Variable in Oracle
TNS_ADMIN Environment Variable in Oracle
When multiple installation of Oracle homes and client are done, Use of TNS_ADMIN is defined for tnsnames.ora location. TNS_ADMIN environment variable specifies the directory location for the tnsnames.ora file.
If tnsnames.ora is not properly set then it will give the following errors:
ORA-12154: TNS: could not resolve service name or SQL*NET Unable to resolve service name.
Set in Environment Variable of Windows:
- Search the Environment Variables and open window.
- In the System variables section click the New button for create new entry.
- Enter a variable name as TNS_ADMIN then enter a variable value of the path to the TNSNAMES.ORA file that will be used as the default.
For example:
Name: TNS_ADMIN
Value: C:\data\app\oracle\product\dbhomeXE\network\admin
For set at command prompt:
1 | SET TNS_ADMIN=C:\data\app\oracle\product\dbhomeXE\network\admin |
Set TNS_ADMIN Parameter in Linux
First we need to create a directory which will act as a central location for listener.ora & tnsnames.ora. Please Note : keep it outside any specific ORACLE_HOME1 | mkdir -p $ORACLE_BASE /network |
1 | export TNS_ADMIN= $ORACLE_BASE /network |