3

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?

| improve this question | | | | |
  • 2
    Just as an aside, in general, the instant client is designed to be deployed as part of an application installer (i.e. you're distributing an installer that installs your app and also happens to install and configure the instant client). If you are setting things up manually, you are probably better off using the full client which has its own installer and takes care to get things configured correctly (it also installs a bunch of utilities that among other things are quite useful for troubleshooting when issues arise). – Justin Cave Sep 18 '19 at 18:05
  • Locating the tnsnames.ora file can be complex, see stackoverflow.com/questions/28280883/… However, setting the TNS_ADMIN is the easiest way of doing it. – Wernfried Domscheit Sep 19 '19 at 6:33
3

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 
| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.