TNS Configuration files – Search order

Oracle clients (and programs that use Oracle clients/drivers) will search for TNS configuration files such as sqlnet.ora and tnsnames.ora in the following order.

Note that the first file to be found will be used — so if there were files in both location 3 and location 5, then the one in location 3 would be found first and used.

For UNIX systems:

  1. $HOME for hidden (dot) files only — e.g. .sqlnet.ora and .tnsnames.ora
  3. $HOME
  4. /etc or /var/opt/oracle (depending on platform)
  5. $ORACLE_HOME/network/admin

For Windows systems:

  1. Current path (associated with the running client application)
  2. Environment variable TNS_ADMIN defined for the user/session
  3. Environment variable TNS_ADMIN defined for the system
  4. Windows Registry Key TNS_ADMIN (beware of virtualized applications that have their own private version of the registry which you cannot view).
  5. %ORACLE_HOME%networkadmin

One thought on “TNS Configuration files – Search order

Add yours

  1. Handy, cheers Rob. I was battling with this the other day on Windows as our team has become de facto Toad support an no one else wants to go near it!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

Up ↑

%d bloggers like this: