I'm using Oracle 12c in Debian 8 (on a vm)
This question is for educational purposes only. I'm not using any production servers, so anything that you can tell me won't have consecuences
To start with, I found this link to delete registers in tnsnames.ora
. I didn't test it yet because first, I needed to know if there were active connections in the database using the information of the tnsnames.ora
.
I'm asking here because I found no way of doing this, but it may be possible to do it.
For you to know, I'm using this command for connecting to the database, so that I clearly specify a tnsname
rlwrap sqlplus sys as sysdba@tnstest
The contents of my tnsnames.ora
are the following
tnstest =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1539))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
But, if I want to be 100% sure that this is working, I use this command
tnsping tnstest
Which results are...
TNS Ping Utility for Linux: Version 12.2.0.1.0 - Production on 28-JAN-2020 23:51:38
Copyright (c) 1997, 2016, Oracle. All rights reserved.
Used parameter files:
/opt/oracle/product/12.1.0.2/dbhome_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1539))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
OK (0 msec)
After all of this I know that my configuration is working, I'm using a register in tnsnames.ora
for the connection, but I don't know a way of checking...
"Hey, now that I'm connected, I want to know which register I used from the tnsnames file for connecting, if I used that file of course"
Is there any possibility that I could get this information?
Well, my following attempts of trying to figure this out, were checking the v$session
view, if there was any field that I could use to get this information, but I couldn't find one.
After all of this, ultimately, I came here for asking. I don't know what else to try nor I have more ideas of what should I do next.
P.S: there's a chance that this problem is impossible to solve, because this is task I'm doing due to I'm a student of sysadmin, and our teacher intentionally added unsolvable questions.
Even so, I still think there might be a solution for this particular case