Create tnsnames.ora
Question: I have just finished installing
Oracle. I want to update my tnsnames.ora file, but I cannot
find a tnsnames.ora file on my system. I thought the
tnsnames.ora file would be created when I created the
database. How do I create the tnsnames.ora?
Answer:
The tnsnames.ora is a SQL*Net configuration file that
normally resides in the ORACLE_HOME/network/admin directory.
Specifically, the tnsnames.ora defines databases addresses
so that connections can be made to them.
The creation of the database itself will not necessarily create the
tnsnames.ora. It is created along with the
sqlnet.ora and listener.ora as part of the network
configuration. Normally, the Network Configuration Assistant (NETCA)
is started at the end of the installation process; however, if NETCA
fails or you exit before completing, the tnsnames.ora and
the other files will not be created. The tnsnames.ora
and the other NETCA created files are not necessary for
connecting to the database locally from the server. They are
just for client access, so it is possible for the database to be
created properly and the files not exist.
The tnsnames.ora file is located on both the client and
server systems, but there will be only one tnsnames.ora on
each server regardless of how many database instances exist.
If you have run NETCA and cannot locate the tnsnames.ora
file, check to see if the
tns_admin parameter has been set to specify a
different directory. If you have not run NETCA, do so to
create the tnsnames.ora file.
The easiest way for experienced users to edit the
tnsnames.ora file is by using a text editor to manually update
the file; however, the SQL*Net Easy Configurator GUI can also be
used. It has wizards the help guide users through the process
of configuring as many connections as they want.
The basic format of the tnsnames.ora file is:
net_service_name=
(description=
(address=(protocol_address_information))
(connect_data=
(service_name=service_name)))
A sample tnsnames.ora entry might look like the
following:
ORATST=
(description=
(address_list=
(address = (protocol = TCP)(host = fu.bar)(port = 1521))
)
(connect_data =
(service_name=oratst)
)
)
Where the following parameters are used:
-
description: This tnsnames.ora
parameter acts as a container for a connect descriptor. It
can be embedded under the description_list parameter in
the tnsnames.ora file.
- description_list: This
tnsnames.ora parameter defines a list of connect
descriptors for a particular net service name .
-
address: This tnsnames.ora parameter
defines a single listener protocol address. It can be
embedded under the address_list or description
parameters in the tnsnames.ora file.
-
address_list: This tnsnames.ora
parameter defines multiple listener protocol addresses. It
is not necessary if only one listener protocol address is used.
It can be embedded under the description or
description_list parameters in the tnsnames.ora
file.
For multiple addresses, the following description section parameters
are also available for the tnsnames.ora file:
-
enable: Set to BROKEN to enable
keepalive feature on the supported TCP transports. By
default, the keepalive feature is OFF>
-
failover: Use this parameter to enable
or disable connect-time failover for multiple protocol
addresses. Setting the parameter to ON, YES or TRUE will result
in Oracle Net, at connect time, failing over to a different
address if the first protocol address fails. Setting the
parameter to OFF, NO or FALSE will result in Oracle Net
trying only one protocol address. The default is ON for
descriptions, description_lists and
address_lists.
-
load_balance: Use this parameter to
enable or disable client load balancing for multiple protocol
addresses. Setting the parameter to ON, YES or TRUE causes the
Oracle Net to progress through the list of addresses in a random
sequence, balancing the load on the various listener or Oracle
Connection Manager protocol addresses. Setting the
parameter to OFF, NO or FALSE will result in Oracle Net
sequentially trying the protocol addresses until one works. The
default is ON for description_lists.
-
recv_buf_size: Use this parameter,
supported by TCP/IP, TCP/IP with SSL and SDP protocols, to
specify, in bytes, the buffer space for receive operations of
sessions. The default for this parameter is OS specific.
-
sdu: Use this parameter in the
connect descriptor, embedded under the description
parameter, on a client to override the default_sdu_size
parameter in the client-side sqlnet.ora file in order
to optimize the transfer rate of data packages across the
network. The default setting is 8192 (8 KB), and the
available range is 512 to 32767 bytes.
- send_buf_size:
Use this parameter in the connect
descriptor, embedded under the description parameter,
on a client to override the send_buf_size parameter in
the client-side sqlnet.ora file. This
parameter, supported by TCP/IP, TCP/IP with SSL and SDP
protocols, specifies, in bytes, the buffer space for send
operations of sessions. The default for this parameter is
OS specific.
-
source_route: Set the
source_route parameter to ON or YES to enable routing
through multiple protocol addresses in the specified order until
the destination has been reached. This parameter can be embedded
under the description, description_list or
address_list parameter. The default setting is OFF.
More information on tnsnames.ora is available
HERE.
Also see the additional information on creating and editing
listener.ora and
sqlnet.ora.
|
|
Get the Complete
Oracle SQL Tuning Information
The landmark book
"Advanced Oracle
SQL Tuning The Definitive Reference" is
filled with valuable information on Oracle SQL Tuning.
This book includes scripts and tools to hypercharge Oracle 11g
performance and you can
buy it
for 30% off directly from the publisher.
|