Table of Contents

About

Located primarily on the clients, this file contains net service names mapped to connect descriptors and is a part of the local naming method in order to make a database connection.

If the file is not found in the directory specified by the TNS_ADMIN, then Oracle Net will check the ORACLE_HOME/network/admin directory.

Example

Simple format

net_service_name =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oel11g)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl.localdomain)
    )
  )

Cluster TNS name

RAC1 =
(
   DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCP)(HOST = HOST_RAC1)(PORT = 1521))
     (ADDRESS = (PROTOCOL = TCP)(HOST = HOST_RAC2)(PORT = 1521))
     (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = MY_RAC_SERVICE_NAME)
     )
)

Location

The tnsnames.ora file is located in the $Oracle_Home\Network\Admin\ directory.

Configuration

The Tnsnames must be in the directory given by the TNS_ADMIN directory.

echo %TNS_ADMIN%
D:\svn\Config\Oracle Database