Professional Documents
Culture Documents
Listener's name
Control parameters
It is possible to configure multiple listeners, each with unique name, in one listener.ora file.
Multiple listener configuration is possible because each of the top-level configuration
parameters has a suffix of the listener name or is the listener name itself.
This section describes the Client configurations, including:
Naming Methods
Configuring Name Methods
Configuring Local Net Service Name
Testing Oracle Net Connectivity
Naming Methods
Oracle Net provides support for the following naming methods:
Easy connect naming: The easy connect naming method enables clients to
connect to an Oracle database server by using a TCP/IP connect string consisting of
a host name and optional port and service name as follows:
CONNECT username/password@host[:port][/service_name]
The easy connect naming method requires no configuration.
Local naming: The local naming method stores connect descriptors (identified by
their net service name) in a local configuration file named tnsnames.ora on the
client.
Directory naming: To access a database service, the directory naming method
stores connect identifiers in a centralized directory server that is compliant with the
Lightweight Directory Access Protocol (LDAP).
External naming: The external naming method stores net service names in a
supported non-Oracle naming service. Supported third-party services include:
Network Information Service (NIS) External Naming
Distributed Computing Environment (DCE) Cell Directory Services (CDS)
Easy Connect
With Easy Connect, you supply all information that is required for the Oracle Net
connection as part of the connect string. Easy Connect connection strings take the
following form:
<username>/<password>@<hostname>:<listener port>/<service
name>
The listener port and service name are optional. If the listener port is not provided,
Oracle Net assumes that the default port of 1521 is being used. If the service name
is not provided, Oracle Net assumes that the database service name and host name
provided in the connect string are identical.
Assuming that the listener uses TCP to listen on port 1521 and the
SERVICE_NAMES=db and DB_DOMAIN=us.oracle.com instance parameters,
the connect string shown in the slide can be shortened:
SQL> connect hr/hr@db.us.oracle.com
Note: The SERVICE_NAMES initialization parameter can accept multiple comma-
separated values. Only one of those values must be db for this scenario to work.
Local Naming
With local naming, the user supplies an alias for the Oracle Net service. Oracle Net
checks the alias against a local list of known services and, if it finds a match,
converts the alias into host, protocol, port, and service name.
One advantage of local naming is that the database users need to remember only a
short alias rather than the long connect string required by Easy Connect.
The local list of known services is stored in the following text configuration file:
<oracle_home>/network/admin/tnsnames.ora
This is the default location of the tnsnames.ora file, but the file can be located
elsewhere using the TNS_ADMIN environment variable.
Local naming is appropriate for organizations in which Oracle Net service
configurations do not change often.
Directory Naming
With directory naming, the user supplies an alias for the Oracle Net service. Oracle
Net checks the alias against an external list of known services and, if it finds a
match, converts the alias into host, protocol, port, and service name. Like local
naming, database users need to remember only a short alias.
One advantage of directory naming is that the service name is available for users to
connect with as soon as a new service name is added to the LDAP directory. With
local naming, the database administrator (DBA) must first distribute updated
tnsnames.ora files containing the changed service name information before
users can connect to new or modified services.
Directory naming is appropriate for organizations in which Oracle Net service
configurations change frequently.
External Naming Method
The external naming method stores Net Service names in a supported non-Oracle
naming service. Supported third-party services include:
Network Information Service (NIS) External Naming
Distributed Computing Environment (DCE) Cell Directory Services (CDS)
Conceptually, external naming is similar to directory naming.
Sqlnet.ora is a text file that provides SQL*Net with basic configuration details like tracing
options, default domain, encryption, etc. This file can be found in the $ORACLE
HOME\NETWORK\ADMIN directory.
Make sure that Host Name is listed in the Selected Naming Methods window. If other
methods are also chosen, make sure Host Name appears first. Click Next to finish. Your
changes will be written to the sqlnet.ora file:
$ORACLE_HOME/network/admin/sqlnet.ora
NAMES.DIRECTORY_PATH= (HOSTNAME)
The sqlnet.ora File
The sqlnet.ora file controls the behavior of Oracle Net Services.
The default location is $ORACLE_HOME/network/admin on UNIX and
%ORACLE_HOME%\network\admin on NT. The default location can be
overridden by defining the TNS_ADMIN environment variable.
The NAMES.DIRECTORY_PATH parameter controls how Oracle Net Services
resolves net service names into connect descriptors. Multiple methods can be
represented as a comma separated list enclosed by parentheses. Net services
attempts to resolve service names using each method listed working from left
to right.
Once the naming methods and service names have been configured and
tested successfully, you can connect to the server from the client by using any
Oracle client tool.
A tnsnames.ora file maps net service names to connect descriptors. The net service name
thus becomes a (most likely shorter and more readable) alias for the somewhat
cumbersome net service name.
TNSNAMES.ORA is a SQL*Net configuration file that defines databases addresses for
establishing connections to them. This file normally resides in the $ORACLE
HOME\NETWORK\ADMIN directory.
The TNSNAMES.ORA files are located on both client and server systems. If you make
configuration changes on the server
($ORACLE_HOME/network/admin/tnsnames.ora) ensure you can connect to the
database through the listener if you are logged on to the server. If you make
configuration changes on the client ensure you can connect from your client
workstation to the database through the listener running on the server.
The tnsnames.ora File
The tnsnames.ora file is used to store net service names. The default location is
$ORACLE_HOME/network/admin on UNIX and %ORACLE_HOME%\network\ admin
on NT. The content of the tnsnames.ora is as follows:
iptvmem … Net service name and domain name.
DESCRIPTION Keyword for describing the connect descriptor. Descriptions
are always specified the same way.
ADDRESS Keyword for the address specification. If multiple addresses
are specified, use the keyword ADDRESS_LIST prior to the ADDRESS
PROTOCOL Specifies the protocol used.
HOST Protocol-specific information for TCP/IP-Specifies the host
name of the server or IP address. Can differ for another protocol.
PORT Protocol specific information for TCP/IP-Specifies the port
number on which the server side listener is listening.
CONNECT_DATA Specifies the database service to which to connect.
Testing Oracle Net Connectivity
tnsping is the Oracle Net equivalent of the TCP/IP ping utility. It offers a quick test
to verify that the network path to a destination is good. For example, enter
tnsping orcl in a command-line window.
The utility validates that the host name, port, and protocol reach a listener. It does
not actually check whether the listener handles the service name. The tnsping
utility also reveals the location of the configuration files. In a system with multiple
ORACLE_HOME locations, this can be helpful.