Oracle Networking Products Getting Started for Windows Platforms Release 8.0.3 A53746-01 |
|
This appendix describes following:
The TNSNAMES.ORA file is used by clients and distributed database servers to identify potential server destinations.
Note::
The Oracle Net8 Assistant creates TNSNAMES.ORA in ORACLE_HOME\NET80\ADMIN on the clients. TNSNAMES.ORA must be manually added on the server for server-to-server connections. |
This example is a sample TNSNAMES.ORA file:
################
# Filename......: tnsnames.ora # Name..........: LOCAL_REGION.world # Date..........: 04-DEC-96 13:50:40 ################ <service_name>.world = <---world is the domain name (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = <---listener address (PROTOCOL = TCP) (HOST = <server _name>) <---or, use IP address of NT server (PORT = 1521) <---must match port in LISTENER.ORA file ) ) (CONNECT_DATA = (SID = <SID>)) <---database name, default is ORCL ) )
TNSNAMES.ORA is comprised of two parts:
These elements are described in the following sections.
Every service requires a connect descriptor. For a database, a connect descriptor describes the location of the network listener and the system ID (SID) of the database to which to connect. For a Connection Manager, a connect descriptor describes the location of the Connection Manager, the location of the network listener, and the system ID (SID) of the database to which to connect. Connect descriptors are stored in the TNSNAMES.ORA client configuration file. The TNSNAMES.ORA file is installed in the Oracle8 home directory under ORACLE_HOME\NET80\ADMIN. Database connect descriptors typically consist of two sections:
The application address is the information required to reach the application within a given protocol environment. It includes the
Oracle Net8 Assistant automatically provides the correct protocol specific parameters for common protocols, but you must provide the appropriate values. For information about the parameter values of a given protocol, see the section "Configuring TNSNAMES.ORA for Oracle Protocol Adapters" in this chapter.
Net8 uses the CONNECT_DATA keyword to denote the SID of the remote database. When Net8 on the server side receives the connection request, TNS passes the CONNECT_DATA contents to the network listener, which identifies the desired database.
For Net8 use, sample CONNECT_DATA contents can look like:
(CONNECT_DATA = (SID = ORCL)
Below is the connect descriptor syntax of the TNSNAMES.ORA file.
<service_name>.world = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (protocol adapter information) ) ) (CONNECT_DATA = (SID = SID) ) )
See "Configuring TNSNAMES.ORA for Oracle Protocol Adapters" in this chapter for a description of the keywords.
All connect descriptors are assigned service names (or database aliases) in the TNSNAMES.ORA file. The user specifies the service name-a single word rather than the lengthier connect descriptor-to identify the service to which to connect. The TNSNAMES.ORA file consists of a series of service names mapped to TNS connect descriptors.
If you are using Oracle Names Server, the service name for a database must be exactly the same as the global database name defined by the system administrator. Net8 limits the total length of a global database name to 64 characters. Of these, up to eight are the DB_NAME as defined by the database administrator, and the remainder show the service's place in the domain hierarchy (DB_DOMAIN). The name part of the service name can be longer than eight characters only if the DBA changes the name of the database with a RENAME GLOBAL_NAME parameter. The total global database name, or service name, must remain at or below 64 characters.
Alternate service names can be assigned to a database service through the TNSNAMES.ORA file. The alternate service names can be names you choose because you find them convenient and easy to remember. For example, if a database is used by two different divisions of a company, Human Resources and Finance, you can map two different service name aliases, hr and finance to the database. The TNSNAMES.ORA file has three separate entries:
Note:
Although you can have multiple aliases for the same database service, you cannot have multiple listeners for the same database service. |
This section describes the address format used in a client's TNSNAMES.ORA file for the following Oracle Protocol Adapters:
TNSNAMES.ORA defines the location of Oracle8 Server machines to which a client can connect.
The table below describes the parameters used by the Oracle Protocol Adapters. Refer to this table for definitions as you review the syntax examples provided throughout this section.
When using the Oracle TCP/IP Protocol Adapter, specify the address of a TNS-based application in the following format:
(ADDRESS = (PROTOCOL = TCP) (HOST = server_name) (PORT = port_number)
The entry below is taken from a client machine that connects to a single Oracle8 Server named GREENWOOD on a TCP/IP network.
GREEN.world = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = GREENWOOD) (PORT = 1521) ) ) (CONNECT_DATA = (SID = ORCL) ) )
When using the Oracle SPX Protocol Adapter, specify the address as follows:
(ADDRESS = (PROTOCOL = SPX) (SERVICE = tns_application)
The entry below is taken from a client machine that connects to a single Oracle8 Server named GREENWOOD on an SPX/IPX network.
GREEN.world = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = SPX) (SERVICE = ORCL_LSNR) ) ) (CONNECT_DATA = (SID = ORCL) ) )
When using the Oracle Named Pipes Protocol Adapter, specify the address of a TNS-based application as follows:
(ADDRESS = (PROTOCOL = NMP) (SERVER = server_name) (PIPE = pipe _name)
The entry below is taken from a client machine that connects to a single Oracle8 Server named GREENWOOD on a Named Pipes network.
GREEN.world = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = NMP) (SERVER = GREENWOOD) (PIPE = dbpipe0) ) ) (CONNECT_DATA = (SID = ORCL) ) )
When using the Bequeath Protocol Adapter, specify the address of a TNS-based application as follows:
(ADDRESS = (PROTOCOL = BEQ) (PROGRAM = oracle80) (ARGV0 = oracle80SID) (ARGS = `(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))')
The entry below is taken from a client machine that connects to a single Oracle8 Server named GREENWOOD on a Bequeath network.
GREEN.world = (DESCRIPTION = (ADDRESS_LIST = (PROTOCOL = BEQ) (PROGRAM = oracle80) (ARGV0 = oracle80ORCL) (ARGS = `(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))') ) ) (CONNECT_DATA = (SID = ORCL) ) )
The SQLNET.ORA file is used by all clients and the server on the network.The SQLNET.ORA file contains information about Oracle Names such as the default domain for service names stored in Oracle Names, and list of preferred Names Servers. It may also contain optional logging and tracing, and security parameters.
Note: The SQLNET.ORA file is automatically installed on the server at ORANT\NET80\ADMIN. Network Configuration Tool generates it on the clients at ORACLE_HOME\NET80\ADMIN.
A sample file is shown below:
################ # Filename......: sqlnet.ora # Name..........: TCP.world # Date..........: 04-DEC-96 13:50:40 ################ AUTOMATIC_IPC = OFF <---set this to OFF if you do not wish to use IPC TRACE_LEVEL_CLIENT = OFF <---set this to 16 if tracing is required names.directory_path = (TNSNAMES) names.default_domain = world name.default_zone = world
This section covers the following SQLNET.ORA configuration parameters issues:
Note:
Many of these SQLNET.ORA parameters must be manually added. |
The optional server parameter, SQLNET.EXPIRE_TIME, determines how often the listener sends a probe to verify that a client-server connection is still active. If a client is abnormally terminated, a connection remains open indefinitely unless identified and closed by the system. If you specify this parameter, the server sends a probe periodically to determine whether there is an invalid connection to terminate. If it finds a dead connection, or a connection no longer in use, it returns an error, causing the server process to exit. This parameter must be set in the SQLNET.ORA file on the server.
When specifying this parameter, enter the time, in minutes, between probes for a dead connection. The range of possible values is from one to a very large number. However, a value of approximately 10 is recommended. If no value is entered in this field, the broken connections remain indefinitely.
Note: The time set in this parameter is not necessarily the amount of time a dead connection will remain. This parameter sets the time between probes for dead connections. Depending on the underlying protocol, shutting down a dead process can take longer.
Dead connection detection has costs associated with it:
In short, evaluate carefully whether you benefit from enabling the dead connection detection feature. Turn it on only if necessary.
The following logging and tracing parameters are automatically added to the SQLNET.ORA file.
Note::
Log and trace file names have a maximum limit of eight characters. |
Additional Information:
See the Net8 Administrator's Guide for a complete listing of all SQLNET.ORA parameters. |
All errors that occur in Net8 are written to log files, while detailed sequence of events as they happen are written to trace files. Trace files provide more information than log files.
You can also manually add the following optional tracing parameters for the TNSPING80 utility to Net8. TNSPING80 determines whether or not a service (such as database, Oracle Names Server, or other TNS services) on a Net8 network can be successfully reached.
Additional Information:
See the Net8 Administrator's Guide for more information about the logging and tracing parameters in SQLNET.ORA. |
The NAMES.DEFAULT_DOMAIN parameter indicates the domain from which the client most often requests names. When this parameter is set, the domain name will automatically append to the service name.
If you use Oracle Names Server without the Dynamic Discovery Option, another parameter, NAMES.PREFERRED_SERVERS, is required. This parameter includes one or more addresses of the Names servers in the order client prefers to use.
Additional Information: |
If the interprocess communication parameter (IPC) AUTOMATIC_IPC is set, Net8 first attempts to connect to the database using the service name (or database alias) as the IPC key. Only if the connection fails, the service name is resolved using the name resolution mechanism defined in the SQLNET.ORA configuration file.
The LISTENER.ORA file is the configuration file for the listener. It resides on the server and defines:
Note:
The LISTENER.ORA file is automatically installed on the server at ORACLE_HOME\NET80\ADMIN. |
A sample LISTENER.ORA file is shown below:
########### # FILENAME: listener.ora # NAME....: Sever name # Date..........: 04-DEC-96 13:50:40 ########### LISTENER = (ADDRESS_LIST = (ADDRESS= (PROTOCOL=IPC) <---IPC is the internal protocol (KEY= service_name) <---automatically added, but necessary ) (ADDRESS= (PROTOCOL=IPC) (KEY =SID) ) (ADDRESS = (PROTOCOL = TCP) (HOST = host_name) <---or, use IP address of NT server (PORT = 1521) ) ) STARTUP_WAIT_TIME_LISTENER = 0 CONNECT_TIMEOUT_LISTENER = 10 TRACE_LEVEL_LISTENER = OFF SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = SID) <---Database name, default is ORCL (GLOBAL_DBNAME=hostname) ) ) PASSWORDS_LISTENER = (oracle)
This section covers the following LISTENER.ORA configuration issues:
You can create connections to multiple databases in two ways, using one or multiple network listeners: (1) you specifically configure one network listener to multiple databases; (2) you configure multiple network listeners, each for a specific database. All the listeners on a single machine share one LISTENER.ORA file.
The listener name can be any easy-to-use name.The default listener name is LISTENER, which is the recommended name in a standard installation that requires only one listener on a machine. The listener name must be unique on the machine running Oracle8. If you have more than one listener on a machine, each requires a unique name. The TURTLE node, for example, might have three listeners with the names:
The listener usually listens both for internal connection requests and for connection requests from across the network.
The listener queries for interprocess calls (IPC) and for calls from other nodes. IPC addresses must be included in the LISTENER.ORA file, if you are using the AUTOMATIC_IPC option.
The IPC address format, which is the same across platforms, is as follows:
(ADDRESS=
(PROTOCOL=IPC)
(KEY=string)
Two IPC addresses are created for each database for which a listener queries. In one, the key value is equal to the service name. This IPC address is used for connections from other applications on the same node. Service names are described in the section "Understanding the TNSNAMES.ORA File" in this chapter. In the other IPC address, the key value is equal to the database SID, which is described in the next section.
Note:
If the service name is the same as the SID, only one IPC address is needed. |
The LISTENER.ORA file describes the database SIDs for which the listener queries. These are the same SIDs listed in the client's TNSNAMES.ORA file. It is made up of keyword-value pairs.
SID_LIST_listener_name= (SID_LIST = (SID_DESC = (SID_NAME = SID) ) )
The SID is the Oracle SID of the database server.
(SID_NAME = db2) ) )
This release does not support Prespawned Dedicated Server Processes by the listener. Do not include the following parameters in each SID_DESC of the LISTENER.ORA file:
The following parameters control the behavior of the listener:
Note::
Log and trace file names have a maximum limit of eight characters. |
Additional Information:
See the Net8 Administrator's Guide for a complete listing of all LISTENER.ORA parameters. |
Clients do not need a TNSNAMES.ORA file if the Oracle Names Server is used. If ONAMES is included in the parameter NAMES_DIRECTORY_PATH in the SQLNET.ORA file, the client uses DDO to resolve the name. A Net8 server requires the following entries in the LISTENER.ORA file for a listener to register itself as a service to a well known name server:
SID_LIST_listener_name= (SID_LIST = (SID_DESC = (SID_NAME = ORCL) (GLOBAL_DBNAME = ORCL.world) ) USE_PLUG_AND_PLAY_listener_name=ON
where listener_name is the name of the listener. LISTENER is the name of the default listener.
Additional Information:
See the Net8 Administrator's Guide to learn more about planning, configuring, running and managing Oracle Names Server. |
Clients do not need a TNSNAMES.ORA file if the host naming adapter is used. A NET8 Server requires the following entry in the LISTENER.ORA file to use host naming names resolution:
SID_LIST_listener_name= (SID_LIST = (SID_DESC = (SID_NAME = ORCL) (GLOBAL_DBNAME = hostname) )
where
The CMAN.ORA file is the configuration file for the Connection Manager on the server. This section discusses how to enable these features of the Connection
Note: The CMAN.ORA file must be manually created on the server in ORACLE_HOME\NET80\ADMIN.
A sample CMAN.ORA file is shown:
# # Connection Manager config file # cman.ora # # # cman's listening addresses # cman = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = <server _name>) <---or, use IP address of server where CMAN resides (PORT = 1610) ) (ADDRESS = (PROTOCOL = TCP) (HOST = <server _name>) (PORT = 1620) ) # # cman's configurable params # # MAXIMUM_RELAYS defaults to 8 # LOG_LEVEL defaults to 0 # TRACING defaults to no # RELAY_STATISTICS defaults to no # SHOW_TNS_INFO defaults to no # USE_ASYNC_CALL (for nscall/nsanswer/nsaccept calls) # defaults to yes # AUTHENTICATION_LEVEL defaults to 0 # MAXIMUM_CONNECT_DATA defaults to 1024 # ANSWER_TIMEOUT defaults to 0 # cman_profile = (parameter_list= (MAXIMUM_RELAYS=1024) (LOG_LEVEL=1) (TRACING=yes) (RELAY_STATISTICS=yes) (SHOW_TNS_INFO=yes) (USE_ASYNC_CALL=yes) (AUTHENTICATION_LEVEL=0) ) # #========================================================================== # cman is used as a TCP fire wall proxy IF AND ONLY IF "cman_rules" exists #========================================================================== # #CMAN_RULES = (RULES_LIST= # (RULE=(SRC=hostname)(DST=hostname)(SRV=hostname)(ACT=ACCEPT)) # )
Note:
USE_ASYNC_CALL can only be enabled in systems with WINSOCK2 support. |
The next section discusses:
The listening address is a combination of the service name and address. The format of the address is similar to the listening addresses in the LISTENER.ORA file, except for the exclusion of the CONNECT_DATA segment.
These addresses are defined in the following format:
cman =(ADDRESS_LIST = (ADDRESS = (protocol adapter information) )
Additional Information:
See Net8 Administrator's Guide for a complete descriptions of all CMAN.ORA parameters. |
In order to have access control on your database server, you need to specify whom to accept or reject in the RULES configuration parameter. The rules specification involves these elements:
You can specify several rules for a single access control to fine tune whom accesses your database server.
CMAN_RULES = (RULES_LIST= (RULE=(SRC=hostname)(DST=hostname)(SRV=SID)(ACT=ACCEPT)) )
A source route address is registered automatically from every client to every server's listening address through a Connection Manager. However, there may be a situation where you need to go through two Connection Managers to get the client request to the server. In this scenario, you would configure your own source route address in the client TNSNAMES.ORA file as follows:
################
# Filename......: tnsnames.ora # Name..........: LOCAL_REGION.world # Date..........: 04-DEC-96 13:50:40 ################ <service_name>.world = <---world is the domain name (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = <---Connection Manager listening address (PROTOCOL = TCP) (HOST = <server _name>) <---or, use IP address of server where CMAN resides (PORT = 1610) <---must match port in CMAN.ORA file ) (ADDRESS = <---listener address (PROTOCOL = TCP) (HOST = <server _name>) <---or, use IP address of NT server (PORT = 1521) <---must match port in LISTENER.ORA file ) ) (CONNECT_DATA = (SID = <SID>)) <---database name, default is ORCL (SOURCE_ROUTE=yes) ) )
where:
Parameter | Description |
---|---|
CONNECT_DATA |
Indicates that application-specific data is supplied at connect time. |
SID |
Specifies the SID of the database server. You must specify the |
SOURCE_ROUTE |
Creates a source route of addresses through all Connection Managers to the destination address. This parameter must be manually added. See "Understanding the CMAN.ORA File" in this chapter for more information. |
You can enable MPI support in two different ways:
An example of the entry in the TNSNAMES.ORA file appears as:
db1=(DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(protocol=spx) (SERVICE=orasrvc1) (ADDRESS=(portocol=tcp) (host=dsteifel-pc3) (port=1610)) (CONNECT_DATA=(SID=db1)) (SOURCE_ROUTE=yes)) )
In an Oracle Names environment, MPI is enabled by default. No further configuration is necessary to use MPI.
MPI can be used in a dedicated or dispatched (MTS) server process environment.
In a MTS environment, Oracle Connection Manager enables you to multiplex all incoming client requests using the same service name to a single dispatcher over a single transport connection. For example:
db1=(DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(protocol=tcp) (host=tmarc-pc3) (port=1600)) (ADDRESS=(portocol=tcp) (host=dsteifel-pc3) (port=1521) (CONNECT_DATA=(SID=db1)) (SOURCE_ROUTE=yes) ) )
Connection Manager multiplexes requests based on the server address information returned from the listener to which the client connects.
Additional Information:
See: |