Customise Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorised as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.

No cookies to display.

TNS_ADMIN Environment Variable in Oracle

Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
  • User AvatarKiran 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:

  1. Search the Environment Variables and open window.
  2. In the System variables section click the New button for create new entry.
  3. 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_HOME
1
mkdir -p $ORACLE_BASE/network
It’s a good idea to set this parameter inside the .bash_profile and add below line
1
export TNS_ADMIN=$ORACLE_BASE/network
Great, no matter which ORACLE_HOME you are connected to, the lsnrctl utility will ready listener.ora file from TNS_ADMIN location. Also, any tns connections will be using tnsnames.ora file placed inside TNS_ADMIN location!  

Hope it helps!