Oracle Database - tnsnames.ora

> Database > Oracle Database

1 - 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.

Advertising

3 - Example

3.1 - Simple format

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

3.2 - 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)
     )
)

4 - Location

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

5 - Configuration

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

echo %TNS_ADMIN%
D:\svn\Config\Oracle Database
db/oracle/tnsnames.ora.txt · Last modified: 2017/09/06 19:29 by gerardnico