What is tnsname.ora file?

* It contains the information about the server where our remotely connect database is present,the port number information,the DB name,the protocol used.

* If a user wants to  have connection entry into tnsname.ora

* It's located in "$ORACLE_HOME/network/admin" and edit tnsname.ora

Testdb =
 (DESCRIPTION = 
  (ADDRESS_LIST =
   (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.121)(PORT = 1521))
   )
  (CONNECT_DATA =
   (SERVICE_NAME = Testdb)
  )
 )

here "Testdb" is connection string name host "192.168.0.121" port "1521" the service name is "Testdb"

* Generally, most of the people will use the db name as service name

To check our tnsname configuration:

note : ensure the listener is up and running in order to accept the connection

tnsping Testdb

  Note : Difference  B/w Listener.ora and Tnsname.ora ?

Tnsname.ora = The file contains the information about the server where your database is present

Listener.ora=The file contains the information about  the listener which is the users have to connect from a different server.