Understanding SQL*Net
Creating the TNSNAMES.ORA File
The TNSNAMES.ORA file contains the names and addresses of all the services on the network. The service names of databases are mapped to connect descriptors that describe their location on the network. Similarly, the service names of Interchanges are listed with their addresses on the network. The contents of this file are described fully in Appendix A. This section describes the format of the file.
Note: TNSNAMES.ORA file is not needed if the network includes Oracle Names.
Placement of the Service Names
The service name must begin in the first space of a line to be parsed correctly. If you are editing the TNSNAMES.ORA file manually, be sure there are no spaces preceding the service name.
Connect Descriptors
Every database requires a connect descriptor. Database connect descriptors commonly consist of two sections:
ADDRESS Section
The application address is the information required to reach the application within a given protocol environment. A sample valid ADDRESS is:
(ADDRESS=
(COMMUNITY=COM1.HQ.FIN.ACME)
(PROTOCOL=TCP)
(HOST=LONDON_VAX.HQ.FIN.ACME)
(PORT=1526)
)
An address is a set of keyword-value pairs related to a specific application. The keyword ADDRESS is shown at a different indentation, to show that it is the parent or owner of the other keywords. Each set of keyword-value pairs is surrounded by parentheses as shown. In this example, the protocol is identified as TCP/IP. TCP/IP requires two specific parameters: the name of the host computer as defined in TCP/IP, and the PORT number allocated to the network listener. (This may vary depending on what Oracle Network Manager generates. For example, for TCP, the port 1526 might be generated. In SQL*Net version 1, the port was usually 1525.)
For the parameters specific to other protocols, see the Oracle operating system-specific documentation for your platform.
CONNECT DATA Section
SQL*Net uses the CONNECT_DATA keyword to denote the system identifier (SID) and global database name of the remote database. When SQL*Net on the server side receives the connection request, TNS passes the CONNECT_DATA contents to the listener, which identifies the desired database. For SQL*Net use, sample CONNECT_DATA might look like:
(CONNECT_DATA=
(SID=V7PROD)
(global_name=prod.acme.com
)
CONNECT_DATA is a protocol-independent keyword indicating that application-specific data will be supplied at connect time. You must specify the SID in the CONNECT DATA section of the connect descriptor. In SQL*net 2.3, you are also expected to provide the global database name, which is made up of the database name and database domain from the database parameter file.
Interchange Addresses
A connect descriptor for an Interchange consists of only one section: an ADDRESS_LIST section. Within the ADDRESS_LIST section all the addresses of the Interchange are listed, including the required protocol specific keywords.
There is no CONNECT_DATA section in the connect descriptor of an Interchange.
Note: Interchange names and addresses are optional in the TNSNAMES.ORA file. However, they are needed if you wish to access Interchanges from clients using the Interchange Control Utility. Oracle Network Manager automatically includes them in the TNSNAMES.ORA files it generates.