The following is database administration tip #4 from "30 tips in 30 minutes," brought to you by the IOUG. Return to the main page for more tips on this topic.
If you are having trouble with your database connection, you may need to examine which tnsnames file you are using. If you have many tnsnames files on your machine, you may not be reading the one you think you are.
You can have a local version and a system version. When a client connection is requested the service name or parameter is first searched in the local version of this configuration file. If the service is not found in the local version it is searched in the system version.
The system version is located in the "$ORACLE_HOMENET80ADMIN" directory for Oracle8.0 software. The system version is located in the "$ORACLE_HOMENETWORKADMIN" directory for Oracle7, 8i and 9i software. A local version can exist in the current working directory where the application is running. For example, if, on Windows NT you start SQL*Plus in "$ORACLE_HOMEBIN", then Net8 looks for a local TNSNAMES.ORA in "ORANTBIN" before looking for the system version. The connection hassles increase when you have multiple local files in various directories.
Manage only TNSNAMES.ORA file exist and that it be located in a single directory. On Unix platforms, setting the environment variable $TNS_ADMIN=
Get more tips in minutes! Return to the main page.
About the author: Kenny Smith has been working with Oracle technology on HP servers for over a decade. He specializes in Oracle database architecture, database administration and development. He has presented at numerous Oracle conferences on two continents. He has published many articles describing Oracle solutions and has co-authored "Oracle backup and recovery 101" from Oracle Press.
IOUG: Become a member of the IOUG to access the paper referenced here and a repository of technical content created for Oracle users by Oracle users.