TNSNAMES.ORA Learning

If I have an alias entry named “TEST1” in tnsnames.ora twice with different descriptions, which one will Oracle*Net use when connecting to database? What if the duplicate alias entry is in the IFILE referenced from tnsnames.ora – which entry will be used?

In my tests, Oracle*Net reads the tnsnames.ora file from bottom up. So if there are duplicate aliases, the alias on the bottom is the one used.

If you reference IFILE from tnsnames.ora, and if the IFILE has the duplicate, the position of the IFILE reference in tnsnames.ora determines which entry is used. If IFILE is at the very bottom, Oracle*Net reads the entries in that file first, and uses the entry from the IFILE. If IFILE is at the very top of tnsnames.ora, it is read last and hence the bottom entry from tnsnames.ora file is used.