The answer you get depends on which executable you're running.By default, is located in the $ORACLE_HOME/network/admin directory on UNIX operating systems and in the ORACLE_HOME\network\admin directory on Windows operating systems.can also be stored the following locations: The directory specified by the TNS_ADMIN environment variable (or registry value) On UNIX operating systems, the global configuration directory.
(NOTE: Windows-centric answer) Shouldn't it always be "$ORACLE_ HOME/network/admin/tnsnames.ora"?
Then you can just do "echo $oracle_ home" or the *nix equivalent. Which reminds me, there's another monkey wrench in the works called TWO_ TASK According TNS_ADMIN is an environment variable that points to the directory where the SQL*Net configuration files (like and tnsnames.ora) are located. There's the agent home and client home, just to name 2, that have their own network/admin directory.
Not direct answer to your question, but I've been quite frustrated myself trying find and update all of the tnsnames files, as I had several oracle installs: Client, BI tools, OWB, etc, each of which had its own oracle home.
I ended up creating a utility called TNSNames Sync that will update all of the tnsnames in all of the oracle homes.
Clients and database servers (that are clients of other database servers) use the net service name when making a connection with an application.
By default, file can contain net service names with one or more connect descriptors.
sample1= (DESCRIPTION= (SOURCE_ROUTE=yes) (ADDRESS=(PROTOCOL=tcp)(HOST=host1)(PORT=1630)) # hop 1 (ADDRESS_LIST= (FAILOVER=on) (LOAD_BALANCE=off) # hop 2 (ADDRESS=(PROTOCOL=tcp)(HOST=host2a)(PORT=1630)) (ADDRESS=(PROTOCOL=tcp)(HOST=host2b)(PORT=1630))) (ADDRESS=(PROTOCOL=tcp)(HOST=host3)(PORT=1521)) # hop 3 (CONNECT_DATA=(SERVICE_NAME=example.com))) sample2= (DESCRIPTION= (LOAD_BALANCE=on) (FAILOVER=on) (ADDRESS_LIST= (SOURCE_ROUTE=yes) (ADDRESS=(PROTOCOL=tcp)(HOST=host1)(PORT=1630)) (ADDRESS=(PROTOCOL=tcp)(HOST=host2)(PORT=1521))) (ADDRESS_LIST= (SOURCE_ROUTE=yes) (ADDRESS=(PROTOCOL=tcp)(HOST=host3)(port=1630)) (ADDRESS=(PROTOCOL=tcp)(HOST=host4)(port=1521))) (CONNECT_DATA=(SERVICE_NAME=example.com))) Each connect descriptor is contained within the DESCRIPTION parameter.
Multiple connect descriptors are characterized by the DESCRIPTION_LIST parameter. under the DESCRIPTION parameter in the connect string.
For the person who mentioned the TWO_TASK environment variable, that is used to set a default database service name to connect to (which could be a database on another server).
The service name you set TWO_TASK to is then looked up in the file when you connect.
tnsping someconnection TNS Ping Utility for 32-bit Windows: Version 220.127.116.11.1 - Production on 27-AUG-20 08 Copyright (c) 1997 Oracle Corporation. Used parameter files: C:\Oracle92\network\ADMIN\C:\Oracle92\network\ADMIN\TNS-03505: Failed to resolve name R:\tnsping entpr01 TNS Ping Utility for 32-bit Windows: Version 18.104.22.168.1 - Production on 27-AUG-20 08 Copyright (c) 1997 Oracle Corporation. Used parameter files: C:\Oracle92\network\ADMIN\C:\Oracle92\network\ADMIN\Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (COMMUNITY = **) (PROTOCOL = TCP) (Host = ****) (Port = 1521))) (CONNECT_DATA = (SID = ENTPR0 1))) OK (40 msec) R:\ For Windows: Filemon from Sys Internals will show you what files are being accessed.