Document ID: 13984.1
Subject: SQL*Net V2 on Unix - Example Files to get Started Quickly
Last Modified: 23 Mar 95
Author: RPOWELL
Introduction:
~~~~~~~~~~~~~
This article describes the basic steps to setting up SQL*Net V2 TCP/IP
and IPC on a Unix platform. It provides a quick path to getting up and
running.
Examples of the main configuration files are included. These files
should be placed in the directory $TNS_ADMIN or by default in
$ORACLE_HOME/network/admin.
You are strongly advised to set up a special directory and use the
environment variable TNS_ADMIN to point to this for SQL*Net V2. The
example here shows both Dedicated and Multi-Threaded (MTS) setups.
When editting the files braces can be matched up in 'vi' using the '%'
key.
Main Steps:
~~~~~~~~~~~
You should really be on Oracle 7.0.15.4 or higher to use SQL*Net V2.
Prior to this release SQL*Net V2 is Non-Production status.
To set up for MTS you should:
a) Set up TNS_ADMIN in the environment to specify a directory where
the configuration files will be kept. Ensure all users have
this environment variable set.
b) Set up the listener.ora and tnsnames.ora files as per the examples
and configure the init<SID>.ora file to include the MTS parameters.
c) Start the listener:
lsnrctl start
d) Shutdown and startup the database to pick up the init<SID>.ora
changes.
e) Check the server knows of the running database:
lsnrctl services
This should show the dispatchers for each database and any SID's
known for dedicated connections. Look at the addresses of any
registered dispatchers - If any show (HOST=0.0.0.0) then the
'hostname' on your machine is *NOT* set up properly. Correct
this and shutdown / re-start the database.
f) Now test out the connections: Eg:-
sqlplus user/pwd@MV713 should give a shared connection
sqlplus user/pwd@V713 dedicated connection
You can check the connections obtained by monitoring v$session as
the 'system' user:
select username, server from v$session;
A server of DEDICATED denotes a dedicate connection.
A server of NONE or SHARED denotes an MTS connection.
Example 'listener.ora':
~~~~~~~~~~~~~~~~~~~~~~~
# ------------------------------------------------------------------------
# Example listener.ora file. Make sure you use your own 'hostname' below
# ------------------------------------------------------------------------
# This tells the listener WHERE to listen
#
# Note: Do *NOT* enter the comments in the script below
# Ie: Do *NOT* enter the '#' or the text after it. These are
# explanatory comments only.
#
LISTENER =
(ADDRESS_LIST =
(ADDRESS =
(PROTOCOL=tcp)
(HOST=hostname) #<-- Use YOUR machines HOST NAME
(PORT=1521)
(COMMUNITY=UK_SUP_TCPIP) #<-- Optional Community
)
(ADDRESS= #<-- UNIX DOMAIN SOCKETS
(PROTOCOL=ipc) #<-- These are used for 'LOCAL'
(KEY=700) #<-- connections.
(COMMUNITY=UK_SUP_IPC) #<-- Optional Community
)
)
# This tells the listener of DEDICATED services it can connect you to
#
SID_LIST_LISTENER= #<-- Used for DEDICATED connect
(SID_LIST= #<-- requests
(SID_DESC=
(SID_NAME=V713) #<-- Put YOUR $ORACLE_SID value
(ORACLE_HOME=/oracle/v713) #<-- Put YOUR $ORACLE_HOME value
)
(SID_DESC= #<-- Other databases may be added
(SID_NAME=TESTDB) #<-- here
(ORACLE_HOME=/oracle/v714)
)
)
# These parameters control TRACE and LOG output - Set them to suit you
#
TRACE_LEVEL_LISTENER = OFF #<-- Set to ADMIN for tracing
TRACE_DIRECTORY_LISTENER = /tns_admin/trace #<-- Trace output goes here
TRACE_FILE_LISTENER = "listener"
LOG_DIRECTORY_LISTENER = /tns_admin/log #<-- Log output goes here
LOG_FILE_LISTENER = "listener"
# Miscellaneous parameters
#
CONNECT_TIMEOUT_LISTENER = 10 #<-- Allow 10 seconds new connects
STOP_LISTENER = YES
DBA_GROUP = dba #<-- Put your DBA group here
# PASSWORDS_LISTENER = manager #<-- Uncomment for a password
# ------------------------------------------------------------------------
Example 'tnsnames.ora':
~~~~~~~~~~~~~~~~~~~~~~~
# -----------------------------------------------------------------------
# Sample tnsnames.ora file - Clients use this to decide where to call
# NB: *1 You *MUST* use YOUR servers 'hostname' where shown below
# *2 Do *NOT* enter the comments in the script below or you may get
# ORA 6401 errors.
# Ie: Do *NOT* enter the '#' or the text after it. These are
# explanatory comments only.
# -----------------------------------------------------------------------
#
# Local IPC Aliases
#
v713 = #<-- Use for Local Socket DEDICATED connections
(DESCRIPTION =
(ADDRESS= (PROTOCOL=IPC) (KEY=700))
(CONNECT_DATA= (SID=V713) (SERVER=DEDICATED)) #<-- Use YOUR $ORACLE_SID
)
mv713 = #<-- Use this alias for socket MTS connections
(DESCRIPTION =
(ADDRESS= (PROTOCOL=IPC) (KEY=700))
(CONNECT_DATA= (SID=MV713)) #<-- Use YOUR MTS_SERVICE name
) # as defined in init<SID>.ora
# Sample TCP/IP Aliases
#
tcp_v713 =
(DESCRIPTION =
(ADDRESS= (PROTOCOL=TCP) (HOST=hostname) (PORT=1521)) #<-- *1
(CONNECT_DATA= (SID=V713) (SERVER=DEDICATED)) #<-- Use YOUR $ORACLE_SID
)
tcp_mv713 =
(DESCRIPTION =
(ADDRESS= (PROTOCOL=TCP) (HOST=hostname) (PORT=1521)) #<-- *1
(CONNECT_DATA= (SID=MV713)) #<-- Use YOUR MTS_SERVICE
)
# -----------------------------------------------------------------------
Example additions to 'init<SID>.ora':
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ------------------------------------------------------------------------
# init<SID>.ora extension for MTS (Multi-Threaded Server)
# ------------------------------------------------------------------------
#
mts_service= "MV713" #<-- Use YOUR OWN service name here
# The line below tells the dispatchers where the listener is so they
# can call it to register this service. It *MUST* match a listener.ora
# listen address
#
mts_listener_address="(ADDRESS=(PROTOCOL=ipc)(key=700))"
mts_dispatchers= "ipc, 1" #<-- Start 1 IPC dispatcher
mts_dispatchers= "tcp, 1" #<-- Start 1 TCP dispatcher
mts_max_dispatchers=10 #<-- No more than 10 dispatchers
mts_max_servers=10 #<-- No more then 10 shared servers
mts_servers=4 #<-- Start with 4 shared servers
# ------------------------------------------------------------------------
Example 'sqlnet.ora':
~~~~~~~~~~~~~~~~~~~~~
# -----------------------------------------------------------------------
# Sample sqlnet.ora file - Clients and Server use this file
# -----------------------------------------------------------------------
#
# TRACE_LEVEL_CLIENT=16 # Uncomment these for Client trace
# TRACE_DIRECTORY_CLIENT=/tmp # Where to put trace files
# TRACE_FILE_CLIENT=cli # Filename prefix
# TRACE_UNIQUE_CLIENT=TRUE # Append Process ID to filename
#
AUTOMATIC_IPC=OFF # Dont try IPC first unless asked to
#
# TRACE_LEVEL_SERVER=16 # Uncomment these for Server trace
# TRACE_DIRECTORY_SERVER=/tmp # Where to put trace files
# TRACE_FILE_SERVER=srv # Filename prefix
#