Oracle – How to Get Oracle_Home Directory

clientodbcoracle

I'm not asking "where is my home directory", or "how do I find it". I am pretty sure I don't have an Oracle_Home directory and I want one. What is the minimum software package that I should install to get that directory? Or, what is the simplest way to set up the directory odbcad uses for tnsnames.ora?

Background:

I have a Windows 7 32bit computer with an assortment of random non-oracle software on it, which needs to establish an ODBC connection to an oracle database. We have other similar computers with established connections using instantclient_12_1. I was not involved in setting up those other computers.

I installed instanclient_12_1 on the subject computer, set up the ODBC connection in ODBCAD32, and then I got an error:

Unable to connect SQLState=08004 [Oracle][ODBC][Ora]ORA-12154:
TNS:could not resolve the connect identifier specified

OK. That's probably because I forgot to copy over the tnsnames.ora file to get this set up. So I copied my tnsnames.ora from one of the running computers, and then I realized that I don't know where the oracle home directory is on the target computer. I checked my environment variables, and I don't think I even have an oracle home directory. There must be some other software package I need to install to get this running. What am I missing?

Best Answer

Place your tnsnames.ora in a directory of your choice, then set the TNS_ADMIN environment variable.

  • Open CMD, enter sysdm.cpl
  • In the Advanced tab, select Environment Variables
  • Under "System Variables", click on 'New' and enter TNS_ADMIN as the name, and the path where your TNSNAMES.ORA resides as your value

Windows steps from here.

On Linux, it's as easy as setting the variable in your shell startup script, eg .bashrc:

export TNS_ADMIN=/path/to/instant/client