This question (Use tnsnames.ora in Oracle SQL Developer) looks like it should have the answer. But my copy of SQL Developer does not have Advanced under Database (it does have Advanced Parameters, but that's not helping).
I've looked all through the preferences (and help), and can't find where to set it. The accepted answer has a nice picture and this:
In the Preferences options expand Database --> select Advanced --> under "Tnsnames Directory" --> Browse the directory where tnsnames.ora present.
My picture mostly matches, but there is no Tnsnames Directory option at the bottom.
This link (http://www.oracle.com/technetwork/issue-archive/2008/08-may/o38sql-102034.html) gives the following useful information:
A TNS connection uses an alias entry from a tnsnames.ora file. Oracle SQL Developer uses only one tnsnames.ora file. You may have more than one on your local machine or want to use the tnsnames.ora file on a remote machine, so note that Oracle SQL Developer looks sequentially for the tnsnames.ora file in the following locations:
- $HOME/.tnsnames.ora
- $TNS_ADMIN/tnsnames.ora
- /etc/tnsnames.ora (non-Windows systems)
- $ORACLE_HOME/network/admin/tnsnames.ora
- Registry key
I want the $ORACLE_HOME option to be used, but there appears to be a copy in one of the first 2 locations. And I'm not sure where $HOME or $TNS_ADMIN is defined (so I could just copy over my good copy there), or better yet, how to re-define it to use the one in $ORACLE_HOME.
The sequence of checks you mentioned is correct. To see what the tool is using there's 2 choices
1 - In a worksheet type "show tns"
SQL> show tns
TNS Lookup locations
--------------------
Location used:
-------------
/Users/klrice
Available TNS Entries
---------------------
SQL>
2 - Also in the worksheet issue this command.
setloglevel oracle.dbtools.raptor.utils INFO
Blog post with details here : http://krisrice.io/2008-04-16-it-seems-to-come-up-often-that-some/