Regarding to oracle documentation :
TNSNAMES.ORA is a SQL*Net configuration file that defines databases addresses for establishing connections to them. This file normally resides in the ORACLE HOME\NETWORK\ADMIN directory.
Example how connection define :
(ADDRESS = (PROTOCOL = TCP)(HOST = my-server )(PORT = 1521))
(SERVICE_NAME = orcl1)
Sometimes you can Bypass the tnsnames.ora and connect to sqlplus without even Create new connection, all you have to do is put all of the connectivity information in your connection string this type of connection called “EZCONNECT”.
sqlplus username/[email protected][//]host[:port][/service_name]
and to enable EZCONNECT you should add the below line in sqlnet.ora which is located in the same directory $ORACLE_HOME/network/admin
check the below examples :
The Below using the default listener port 1521 :
1- sqlplus scott/[email protected]/orcl1
Different Listener port will be like the below :
2- sqlplus scott/[email protected]:1522/orcl1
3- sqlplus USER/[email protected]//myservername:1521/orcl1
and if you want to disable EZCONNECT For Secuirty Reasons add the below line in :