Where to find tnsname.ora - Debian - oracle

In a Debian machine, I can use tnsping to identify a tnsname.
But I can not found any tnsnames.ora in this machine. (nothing in $ORACLE_HOME/network/admin/ )
So, how can I find the tns name config file used by tnsping command ?
Is there any command (similar with tnsping) to locate the tnsnames file?
UPDATE: tnsping command result:
Thanks in advance

There is no common location and different applications/drivers apply various search paths with different order and precedences.
Check following locations:
$ORACLE_HOME/network/admin/
Current directory of application
$TNS_ADMIN (where TNS_ADMIN is environment variable settings)
Just for completeness in case of Windows check also
Registry key HKLM\SOFTWARE\ORACLE\KEY_{ORACLE_HOME_NAME}\TNS_ADMIN (for 64 bit)
Registry key HKLM\SOFTWARE\Wow6432Node\ORACLE\KEY_{ORACLE_HOME_NAME}\TNS_ADMIN (for 32 bit)
.NET config file (i.e. machine.config and/or web.config)
In ideal case all of them should point to the same location, consider to create symbolic links if needed.
NB, maybe file tnsnames.ora simply does not exist. Create such file in location mentioned above.

You tell us the tnsping is working... At my place the tnsping tool gives the exact location of the sqlnet.ora it is using.... The tnsnames.ora should be in the same directory.
When your environment is correctly configured the tnsnames should be in the mentioned directory. When it does not exist you could try running the netca command and configure "Naming Methods configuration" and add a destination with "Locale Net Service Name configuration". This utility will create sqlnet.ora en tnsnames.ora in the default location.
[oracle#somedir]$ tnsping test
TNS Ping Utility for Linux: Version 11.2.0.3.0 - Production on 27-JUL-2016 22:00:24
Copyright (c) 1997, 2011, Oracle. All rights reserved.
Used parameter files:
/home/oracle/app/oracle/product/11.2.3/dbhome_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = TEST)))
OK (0 msec)

Related

ORA-12154 TNS can't resolve specified identifier

i'm trying to connect to my oracle server using a batch file, but while i try connecting i got the following error:
ORA-12154: TNS: could not resolve the connect identifier specified
I've already check the tnsnames.ora ad the identifier is spelled correctly; i've put in the environment's variable a new variable named TNS_ADMIN that point on my admin folder in the client section.
ty tnsname.ora is as following
ORCL_SRVDATIORIO12 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 1521))
)
(CONNECT_DATA =
(SID = ORCL)
(SERVER = DEDICATED)
)
)
If i try connecting to that server using SSMA for example, using the tnsnames mode (SID or the description name), connection will establish just fine; while running it in command line it return me the error.
Also if i try running
tnsping <my tnsname>
i'll get:
TNS Ping Utility for 32-bit Windows: Version 12.2.0.1.0 - Production on 03-GEN-2019 14:36:59
Copyright (c) 1997, 2016, Oracle. All rights reserved.
File di parametri utilizzati:
C:\app\client\user\product\12.2.0\client_1\network\admin\sqlnet.ora
TNS-03505: Impossible finding name
So i checked the sqlnet.ora file and the directory path seems fine to me:
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT, LDAP)
any suggestion?
EDIT: i solved by simply creating a new text file and copy past the previous contents in the new one.
you need to check tnsnames.ora. tnsnames.ora contains tns names and their connection declarations. You need to use appropriate tns name to connect your database.
tnsping <tns_name> //tns_name is needed to be defined in tnsnames.ora
in your case
tnsping ORCL_SRVDATIORIO12 10
need to return success message. if it does not, it means that your connection decriber is wrong. In which case, you need to talk with your DBA

Test connection works, actual connection ends up with ORA-12154

I'm trying to connect Microsoft SSAS with an Oracle database, with no success. I searched and searched before asking here, and I hoped the problem could lie in some typos in tnsnames.ora and sql.ora file. But unluckily not. I report them here:
sqlnet:
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
tnsnames:
DEVELOPS.WORLD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (COMMUNITY = tcp.world)(PROTOCOL = TCP)(Host = xxx.local)(Port = 1521))
)
(CONNECT_DATA =
(SID = DEVELOPS)
)
)
Note that, when I try "Test Connection" in SSAS, it does work. But as soon as process a table, for example, here comes ORA-12154.
I also tried with ping and tnsping, and they both work: host is up and running and the alias is working, too. Drivers (32bit and 64bit) are both installed. So, I really don't know what to look for.
Thanks!
Most likely SSAS does find your sqlnet.ora, resp. tnsnames.ora file. Looks like each driver has its own method to look for location of these files, see Determining locatation of relevant tnsnames.ora file
Ensure that each setting listed below is pointing to actual location of your sqlnet.ora/tnsnames.ora files. Use Symbolic Links, if required.
Environment varialbe TNS_ADMIN
Registry Key HKLM\SOFTWARE\ORACLE\KEY_{ORACLE_HOME_NAME}\TNS_ADMIN
Registry Key HKLM\SOFTWARE\Wow6432Node\ORACLE\KEY_{ORACLE_HOME_NAME}\TNS_ADMIN
Folder %ORACLE_HOME%\network\admin
TNS_ADMIN setting of section <oracle.manageddataaccess.client> in your .NET config file (only applicable for Oracle ODP.NET Managed Driver)

ORA-12560:TNS:Protocol adapter error [duplicate]

I Google[d] for this error ORA-12560: TNS:protocol adaptor error but not able to find the actual reason and how to solve this error ?
Can anyone tell me a perfect solution to solve login problem.
Go to the windows machine that hosts the Oracle database server
Go to Start -> Run -> Services.msc in Windows.
Locate OracleService < SID > (here OracleServiceORCL) and click on Start to start the oracle database service (if not already running)
Once it is up and running, from the command prompt run the following:
tnsping < tnsalias >
(tnsalias entry you can find it in tnsnames.ora file)
In my case I didn't have an OracleService (OracleServiceORCL) in Windows Services.msc as described in Bharathi's answer.
I executed this command:
C:\> ORADIM -NEW -SID ORCL
and then the OracleService called OracleServiceORCL just showed up and got started in Services.msc. Really nice.
Source: https://forums.oracle.com/forums/message.jspa?messageID=4044655#4044655
Seems like database is not up. It might be due to restarting machine and the instance is not set to autostart and it so not started munually after starting from services Screen.
Just goto Command prompt
Set Oracle SID
C:>set oracle_sid=ORCL
Now run Net start command.
C:>net start oracleserviceORCL
from command console, if you get this error you can avoid it by typing
c:\> sqlplus /nolog
then you can connect
SQL> conn user/pass #host:port/service
Add to the enviroment vars the following varibale and value to identify the place of the tnsnames.ora file:
TNS_ADMIN
C:\oracle\product\10.2.0\client_1\network\admin
In my case (for OracleExpress) the service was running, but I got this issue when trying to access the database via sqlplus without connection identifier:
sqlplus sys/mypassword as sysdba
To make it work I needed to add the connection identifier (XE for Oracle Express), so following command worked ok:
sqlplus sys/mypassword#XE as sysdba
If you still get ORA-12560, make sure you can ping the XE service. Use:
tnsping XE
And you should get OK message along with full connection string (tnsping command is located in oracle's installation dir: [oracle express installation dir]\app\oracle\product\11.2.0\server\bin). If you can not ping make sure your tnsnames.ora file is reachable for sqlplus. You might need to set TNS_ADMIN environment variable pointing to your ADMIN directory, where the file is located, for example:
TNS_ADMIN=[oracle express installation dir]\app\oracle\product\11.2.0\server\network\ADMIN
After searching alot got a simple way to solve it.
Just follow the steps.
Check status of your listener.
open command prompt and type lsnrctl status
You will get no listener.
Now open listener.ora file which is present in following directory: C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN
Open that file and change the host parameter with you computer name
You can get your computer name by right click on My Computer and check you computer name, and replace host parameter with your computer name as follows:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = Electron-PC)(PORT = 1521)
)
)
)
So here you can observe HOST = Electron-PC, which is my computer name.
Save the listener.ora file and again return to cammand propt
3.Type the following in command prompt lsnrctl start
This will start the OracleTNSListner.
you can check it in the service by opening services tab of Task Manager. if not started automatically you can start it.
Just this much and you are ready to work again on oracle.
Best of Luck.
Quite often this means that the listener hasn't started. Check the Services panel.
On Windows (as you are) another common cause is that the ORACLE_SID is not defined in the registry. Either edit the registry or set the ORACLE_SID in a CMD box. (Because you want to run sqlplusw.exe I suggest you edit the registry.)
I have solved the problem the easy way. My oracle was running just fine in the past. After I installed MS SQL Server was when I noticed this problem. I just uninstalled MS SQL Server on my machine then the problem was gone. Make sure you restart your computer after that. Now I can connect to Oracle database through SQLPlus again. My guess is that there's some conflict between the two. Hope this helps.
Another possible solution that just worked for me...considering I was using my local login as the dba permissions.
Follow the steps to get to Services. Right click on the instance and go to 'Log On'? (might not be the name but it's one of the tabs containing permissions). Change the settings to use LOCAL.
If none the above work, then try this :
Modify the LISTENER.ora (mine is found in : oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora) ==> add a custom listener that points to your database(SID), example my SID is XZ0301, so :
## Base XZ03001
SID_LIST_LISTENER_XZ03001=(SID_LIST=(SID_DESC=(ORACLE_HOME =
E:\oracle\product\11.2.0\dbhome_1)(SID_NAME= XZ03001)))
LISTENER_XZ03001=(DESCRIPTION_LIST=(ADDRESS=(PROTOCOL =
TCP)(HOST=MyComputerName)(PORT= 1521)))
DIAG_ADR_ENABLED_LISTENER_XZ03001=ON
ADR_BASE_LISTENER_XZ03001=E:\oracle
Restart your machine
For Windows 7, use the following to modify the LISTENER.ora:
- Go to Start > All Programs > Accessories
- Right click Notepad and then click Run as Administrator .
- File>open and navigate to the tnsnames.ora file.
- Make the changes then it should allow you to save
It really has worked on my machine. But instead of OracleServiceORCL I found OracleServiceXE.
Flow the flowing steps :
Edit your listener.ora and tnsnames.ora file in
$Oracle_home\product\11.2.0\client_1\NETWORK\ADMIN location
a. add listener.ora file
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
)
ADR_BASE_LISTENER = C: [here c is oralce home directory]
b. add in tnsnames.ora file
SCHEMADEV =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = dabase_ip)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = SCHEMADEV)
)
)
Open command prompt and type
sqlplus username/passowrd#oracle_connection_alias
Example : username : your_database_username
password : Your_database_password
oracle_connection_alias : SCHEMADEV for above example.
Just to add up, follow the screenshot and choose local account to start if not selected. Then start the service.
You need to tell SQLPlus which database you want to log on to. Host String needs to be either a connection string or an alias configured in your TNSNames.ora file.
ORA-12560: TNS:erro de adaptador de protocolo
set Environment Variables: ORACLE_BASE, ORACLE_HOME, ORACLE_SID
make sure your user is part of ORACLE_GROUP_NAME (Windows)
make sure the file ORACLE_HOME/network/admin/sqlnet.ora is:
SQLNET.AUTHENTICATION_SERVICES = (NTS)
(Windows) Be carefull when you add a new Oracle client: adding a new path to the PATH env. variable can mess things up. The first entry in this variable makes a difference: certify that the sqlplus executable in the ORACLE_HOME (ORACLE_HOME/bin) comes first in the PATH env. variable.
I try 2 option:
You change service OracleService in Service Tab -> Running
Login with cmd command: sqlplus user_name/pass_word#orcl12C
Note: orcle12c -> name of OracleService name run in you laptop
Below fixes can be applied to resolve TNS 12560 error
Get Latest patch for SQL*NET client software
Set $ORACLE_HOME and $PATH variable (should be accessible for System user)
Check permissions on PC client
Check $TNS_ADMIN variable
Check if network has firewall or antivirus issues
Check if windows services Run >> Services.msc has OracleXE or OracleORCL service running
Check below link in case of net tracing error:
http://dba-oracle.com/t_sql_net_tracing.htm
In my case, (ORA-12560: TNS protocol adapter error)Issue cause of database connection issue like database, user name and password.
Once you got the issue. Initially you have to check connection details, after check the oracle service and further more.
I missed some connection details, So only i got TNS protocol adapter error,
I will changed the connection details, It would be working fine.

Oracle (0x80004005)ORA-12154: TNS:could not resolve the connect identifier

I'm trying to connect to an oracle db from an ASP classic application, however I keep running into the ORA-12154 error.
TNSNAMES.ORA is configured properly
DBSOURCE.A.B.com =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = C.D.B.com)(PORT = 1231))
)
(CONNECT_DATA =
(SERVICE_NAME = DBSOURCE)
)
)
I can TNSPING
C:\Documents and Settings\USERID.A>tnsping DBSOURCE
TNS Ping Utility for 32-bit Windows: Version 10.2.0.4.0 - Production on 09-MAR-2
011 09:12:31
Copyright (c) 1997, 2007, Oracle. All rights reserved.
Used parameter files:
C:\oracle\product\10.2.0\client_1\NETWORK\ADMIN\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = C.D.B.com)(PORT = 1231))) (CONNECT_DATA = (SERVIC
E_NAME = DBSOURCE)))
OK (30 msec)
I can create an ODBC connection and I've tested the connection which is successful.
I can connect to the oracle db through toad.
I've checked my sqlnet.ora file
NAMES.DEFAULT_DOMAIN = A.B.com
SQLNET.AUTHENTICATION_SERVICES= (NONE)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
I've also checked that the TNSNAMES.ORA as one of my system paths.
I can connect to the DB with SQLPLUS
Here is the code that throws the error
dim CnnStr
Set Cnn = Server.CreateObject("ADODB.Connection")
CnnStr="Provider=MSDAORA.1;Password=pass;User ID=user;Data Source=DBSOURCE"
Cnn.Open CnnStr
I am running windows XP Pro 32bit SP3
I've tested this on a co-workers machine and the asp app has no issues, am I missing a configuration somewhere or did I mess up my config?
Thanks for the help everyone!
It seems all the settings have been checked but here is my suggestions for some trouble shooting:
How about restrictions on the account IIS is running under? Does it have the file permissions to read the TNSNAMES? Have you tried to give the user more rights. Even run IIS with Local As System Account? Remember to put it back the way it was.
You are sure there is not 3rd party app such anti virus or firewall that could influence / block access. (Disable them to test but do not forget to re-enable :)
(What did you finally do to solve it?)
"this works on a co-worker machine but
not mine."
ORA-12154 is usually a configuration issue, and it would certainly seem to be so in your case. The short answer is to compare your machine with your colleague's one and figure out what the difference is.
Things to check include:
the TNANAMES.ORA file
the SQLNET.ORA file
the LISTENER.ORA file (if you're using a local database)
Do you have multiple Oracle homes? Check that IIS doesn't point to the other ORA_HOME (and thereby not finding your tnsnames.ora entry).
I'm not very familiar with IIS configuration, so I would test this by adding the TNS entry to all tnsnames.ora on my PC.
If you are running a 64-bit OS and oracle 10 try installing all the patches for oracle.
Something similar happened to me, SQL plus and all else worked, except my .NET program.
I was running a .Net program out of the "Program files (x86)" folder. Installing patches fixed it.
The likely problem is the lack of read permission upon the Oracle directories by the User IIS is running-as.
As #Derick says, temporarily set the permissions wide-open on the $ORACLE_HOME directory (Everyone = Full Control), restart IIS, and test. When that works, give the IIS User read permission against that directory.
You can also confirm this issue using Process Monitor from Microsoft SysInternals, and seeing the failure message during the CreateFile(...) API call to open the DLLs or read the TNSNAMES.ORA file. Given the way temporary files work when selecting through cursors, you may also need to give the IIS user write permissions into some directories.
Try setting the value of the environment variable TNS_ADMIN on the machine with the problem to /network/admin (or wherever your tnsnames.ora file lives) and see if that helps.
I had the similar problem and found a simple solution. You don't have to modify any config files. Hope this can help you:
CREATE DATABASE LINK server2_db
CONNECT TO dbuser IDENTIFIED BY pwd USING
'(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = server_2)(PORT = port_num))
)
(CONNECT_DATA =
(SERVICE_NAME = server2_db)
)
)';
The solution is from here:http://oraclequirks.blogspot.com/2008/11/ora-12154-tnscould-not-resolve-service.html

Oracle - What TNS Names file am I using?

Sometimes I get Oracle connection problems because I can't figure out which tnsnames.ora file my database client is using.
What's the best way to figure this out? ++happy for various platform solutions.
Oracle provides a utility called tnsping:
R:\>tnsping someconnection
TNS Ping Utility for 32-bit Windows: Version 9.0.1.3.1 - Production on 27-AUG-20
08 10:38:07
Copyright (c) 1997 Oracle Corporation. All rights reserved.
Used parameter files:
C:\Oracle92\network\ADMIN\sqlnet.ora
C:\Oracle92\network\ADMIN\tnsnames.ora
TNS-03505: Failed to resolve name
R:\>
R:\>tnsping entpr01
TNS Ping Utility for 32-bit Windows: Version 9.0.1.3.1 - Production on 27-AUG-20
08 10:39:22
Copyright (c) 1997 Oracle Corporation. All rights reserved.
Used parameter files:
C:\Oracle92\network\ADMIN\sqlnet.ora
C:\Oracle92\network\ADMIN\tnsnames.ora
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:\>
This should show what file you're using. The utility sits in the Oracle bin directory.
For linux:
$ strace sqlplus -L scott/tiger#orcl 2>&1| grep -i 'open.*tnsnames.ora'
shows something like this:
open("/opt/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora",O_RDONLY)=7
Changing to
$ strace sqlplus -L scott/tiger#orcl 2>&1| grep -i 'tnsnames.ora'
will show all the file paths that are failing.
There is another place where the TNS location is stored: If you're using Windows, open regedit and navigate to My HKEY Local Machine/Software/ORACLE/KEY_OraClient10_home1 where KEY_OraClient10_home1 is your Oracle home. If there is a string entry called TNS_ADMIN, then the value of that entry will point to the TNS file that Oracle is using on your computer.
On my development machine I have three different versions of Oracle client software. I manage the tnsnames.ora file in one of them. In the other two, I have entered in the tnsnames.ora file:
ifile=path_to_tnsnames.ora_file/tnsnames.ora
This way, if for some reason the wrong tnsnames.ora file is used by a client, it will always end up at the up-to-date version.
Codeslave asks "Shouldn't it always be "$ORACLE_ HOME/network/admin/tnsnames.ora"? The answer is no, it isn't. Consider these two invocations of tnsping on the same machine:
C:\Documents and Settings\me>D:\Oracle\10.2.0_DB\BIN\tnsping orcl
TNS Ping Utility for 32-bit Windows: Version 10.2.0.4.0 - Production on 09-OCT-2
008 14:30:12
Copyright (c) 1997, 2007, Oracle. All rights reserved.
Used parameter files:
D:\Oracle\10.2.0_DB\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = xxxx
)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORCL)))
OK (40 msec)
C:\Documents and Settings\me>tnsping orcl
TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 09-OCT-2
008 14:30:21
Copyright (c) 1997, 2005, Oracle. All rights reserved.
Used parameter files:
D:\oracle\10.2.0_Client\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = XXXX)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = ORCL)))
OK (20 msec)
C:\Documents and Settings\me>
Note the two different parameter file locations, that are dependent on which tnsping executable you're running (and perhaps where it's being run from). For tnsnames-based oracle networking, using the TNS_ADMIN variable is the only way to ensure you're getting a consistent tnsnames.ora file. (NOTE: Windows-centric answer)
For Windows: Filemon from SysInternals will show you what files are being accessed.
Remember to set your filters so you are not overwhelmed by the chatty file system traffic.
Added: Filemon does not work with newer Windows versions, so you might have to use Process Monitor.
By default, tnsnames.ora 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. tnsnames.ora 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. For example, on the Solaris Operating System, this directory is /var/opt/oracle
If you have multiple ORACLE_HOMES, be aware of which one you are using, as the location of the tnsnames.ora file can vary from one ORACLE_HOME to the next.
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 tnsnames.ora file when you connect.
Shouldn't it always be "$ORACLE_ HOME/network/admin/tnsnames.ora"?
Then you can just do "echo $oracle_ home" or the *nix equivalent.
#Pete Holberton
You are entirely correct. Which reminds me, there's another monkey wrench in the works called TWO_ TASK
According http://www.orafaq.com/wiki/TNS_ADMIN
TNS_ADMIN is an environment variable that points to the directory where the SQL*Net configuration files (like sqlnet.ora and tnsnames.ora) are located.
strace sqlplus -L scott/tiger#orcl helps to find .tnsnames.ora file on /home/oracle to find the file it takes instead of $ORACLE_HOME/network/admin/tnsnames.ora file. Thanks for the posting.
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 TNSNamesSync that will update all of the tnsnames in all of the oracle homes. It's under the MIT license, free to use here https://github.com/artybug/TNSNamesSync/releases
The docs are here:
https://github.com/artchik/TNSNamesSync/blob/master/README.md
This is for Windows only, though.
The easiest way is probably to check the PATH environment variable of the process that is connecting to the database. Most likely the tnsnames.ora file is in first Oracle bin directory in path..\network\admin. TNS_ADMIN environment variable or value in registry (for the current Oracle home) may override this.
Using filemon like suggested by others will also do the trick.

Resources