BNFD - Your DBA NoteBook On The Net!!!

Monday, September 8, 2008

3 important Oracle Net files (tnsnames.ora,sqlnet.ora & listner.ora)

tnsnames.ora
A tnsnames.ora file maps net service names to connect descriptors.
In simple words, tnsnames.ora file provides the ability to reference oracle databases by a simple alias.
It can be found in the ORACLE_HOME/network/admin or ORACLE_HOME/net80/admin directory on the client. This file will also be present on the server if client style connections are used on the server itself.
The net service name thus becomes a (most likely shorter and more readable) alias for the somewhat cumbersome net service name.

In the following example, the «text» after the equal sign is the connect descriptor while the text before the equal sign (net_service_name) is the net service name.

$ORACLE_HOME/network/admin/tnsnames.ora
---------------------------------------
dbname1, aliasname1, aliasname2 =
(description =
(address_list =
(address =
(protocol = tcp)(host = yourHost.domain)(port = 1521)))
(connect_data =(sid = yourSID)))

sqlnet.ora
The sqlnet.ora file contains client side network configuration parameters.

The sqlnet.ora file enables you to:
Specify the client domain to append to unqualified names
Prioritize naming methods
Enable logging and tracing features
Route connections through specific processes
Configure parameters for external naming
Configure Oracle Advanced Security
Use protocol-specific parameters to restrict access to the database
It can be found in the ORACLE_HOME/network/admin or ORACLE_HOME/net80/admin directory on the client.

Here is an example of an sqlnet.ora file :
$ORACLE_HOME/network/admin/sqlnet.ora
-------------------------------------
automatic_ipc = ON # Set to OFF for PC's
trace_level_client = OFF # Set to 16 if tracing is required
sqlnet.expire_time = 0 # Idle time in minutes
sqlnet.authentication_services = (ALL)
names.directory_lookup = (TNSNAMES,ONAMES)
names.default_domain = world
name.default_zone = world

listener.ora

Listener.ora file consists of the listener configurations like,
Listener's name
Protocol addresses that it is accepting connection requests on
Services it is listening
Control parameters
By default, the listener.ora file is located in the $ORACLE_HOME/network/admin

A Sample Listener.ora file
$ORACLE_HOME/network/admin/listener.ora
---------------------------------------
LISTENER = # Listener name is LISTENER
(address_list =
(address=
(protocol=ipc)
(key=yourSID)
)
(address=(protocol = tcp)(host = yourHost.domain)(port = 1521)
)
)