Thursday, May 21, 2009

TNSNAMEs.ORA--Transparent Network Substrate

TNSNAMES.ORA

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

DESCRIPTION contains the connect descriptor, ADDRESS contains the protocol address, and CONNECT_DATA contains the database service identification information.

Basic Format of tnsnames.ora File

net_service_name=

(DESCRIPTION=

(ADDRESS=(protocol_address_information))

(CONNECT_DATA=

(SERVICE_NAME=service_name)))

SNS0910srv =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 10.100.0.65)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = sns0910)

)

)

A tnsnames.ora file can contain net service names with one or more connect descriptors. Each connect descriptor can contain one or more protocol addresses.

The tnsnames.ora file also supports connect descriptors with multiple lists of addresses, each with its own characteristics.

In following example, two address lists are presented. The first address list features client load balancing and no connect-time failover, affecting only those protocol addresses within the ADDRESS_LIST. The second protocol address list features connect-time failover and no client load loading balancing, affecting only those protocol addresses within the ADDRESS_LIST. The client first tries either the first or second protocol address at random, then tries protocol addresses three and four sequentially.

net_service_name=

(DESCRIPTION=

(ADDRESS_LIST=

(LOAD_BALANCE=on)

(FAILOVER=off)

(ADDRESS=(protocol_address_information))

(ADDRESS=(protocol_address_information)))

(ADDRESS_LIST=

(LOAD_BALANCE=off)

(FAILOVER=on)

(ADDRESS=(protocol_address_information))

(ADDRESS=(protocol_address_information)))

(CONNECT_DATA=

(SERVICE_NAME=service_name)))

Multiple Oracle Connection Manager Addresses in tnsnames.ora

sample1=

(DESCRIPTION=

(SOURCE_ROUTE=yes)

(ADDRESS=(PROTOCOL=tcp)(HOST=host1)(PORT=1630)) # hop 1

(ADDRESS_LIST=

(FAILOVER=on)

(LOAD_BALANCE=off) # hop 2

(ADDRESS=(PROTOCOL=tcp)(HOST=host2a)(PORT=1630))

(ADDRESS=(PROTOCOL=tcp)(HOST=host2b)(PORT=1630)))

(ADDRESS=(PROTOCOL=tcp)(HOST=host3)(PORT=1521)) # hop 3

(CONNECT_DATA=(SERVICE_NAME=Sales.us.example.com)))

1.The client is instructed to connect to an protocol address of the first Oracle Connection Manager, as indicated by:

(ADDRESS=(PROTOCOL=tcp)(HOST=host1)(PORT=1630))

2. The first Oracle Connection Manager is then instructed to connect to the first protocol address of another Oracle Connection Manager. If the first protocol address fails, then it tries the second protocol address. This sequence is specified with the following configuration:

(ADDRESS_LIST=

(FAILOVER=ON)

(LOAD_BALANCE=off)

(ADDRESS=(PROTOCOL=tcp)(HOST=host2a)(PORT=1630))

(ADDRESS=(PROTOCOL=tcp)(HOST=host2b)(PORT=1630))

3.The Oracle Connection Manager then connects to the database service using the following protocol address:

(ADDRESS=(PROTOCOL=tcp)(HOST=host3)(PORT=1521))

Client Load Balancing in tnsnames.ora

sample2=

(DESCRIPTION=

(LOAD_BALANCE=on)

(FAILOVER=on)

(ADDRESS_LIST=

(SOURCE_ROUTE=yes)

(ADDRESS=(PROTOCOL=tcp)(HOST=host1)(PORT=1630))

(ADDRESS=(PROTOCOL=tcp)(HOST=host2)(PORT=1521)))

(ADDRESS_LIST=

(SOURCE_ROUTE=yes)

(ADDRESS=(PROTOCOL=tcp)(HOST=host3)(port=1630))

(ADDRESS=(PROTOCOL=tcp)(HOST=host4)(port=1521)))

(CONNECT_DATA=(SERVICE_NAME=sales.us.example.com)))

1.The client is instructed to pick an ADDRESS_LIST at random and to failover to the other if the chosen ADDRESS_LIST fails. This is indicated by the LOAD_BALANCE and FAILOVER parameters being set to on.

2. When an ADDRESS_LIST is chosen, the client first connects to the Oracle Connection Manager, using the Oracle Connection Manager protocol address that uses port 1630 indicated for the ADDRESS_LIST.

3.The Oracle Connection Manager then connects to the database service, using the protocol address indicated for the ADDRESS_LIST.

Local Naming Parameters

This section lists and describes the tnsnames.ora file parameters that comprise connect descriptors. Configuration parameters fall into the following categories:

Connect Descriptor Descriptions

Protocol Address Section

Optional Parameters for Lists

Connect Data Section

Security Section

Connect Descriptor Descriptions

net_service_name=

(DESCRIPTION_LIST=

(DESCRIPTION=

(ADDRESS=...)

(CONNECT_DATA=(SERVICE_NAME=sales.example.com)))

(DESCRIPTION=

(ADDRESS=...)

(CONNECT_DATA=(SERVICE_NAME=sales2.us.example.com))))

Protocol Address Section

The protocol address section of the tnsnames.ora file specifies the protocol addresses of the listener.

net_service_name=

(DESCRIPTION=

(ADDRESS_LIST=

(ADDRESS=(PROTOCOL=tcp)(HOST=sales1-svr)(PORT=1521))

(ADDRESS=(PROTOCOL=tcp)(HOST=sales2-svr)(PORT=1521)))

(ADDRESS_LIST=

(FAILOVER=on)

(ADDRESS=(PROTOCOL=tcp)(HOST=sales1-svr)(PORT=1521))

(ADDRESS=(PROTOCOL=tcp)(HOST=sales2-svr)(PORT=1521))

(CONNECT_DATA=(SERVICE_NAME=sales.us.example.com)))

Optional Parameters for Lists

For multiple addresses, the following parameters are available for usage:

ENABLE

The keepalive feature on the supported TCP transports can be enabled for a net service client by embedding (ENABLE=BROKEN) under the DESCRIPTION parameter in the connect string. Keepalive allows the caller to detect a dead remote server, although typically it will take 2 hours or more to notice. Operating system TCP configurables, which vary by platform, define the actual keepalive timing details.

FAILOVER

Use the parameter FAILOVER to enable or disable connect-time failover for multiple protocol addresses.

LOAD_BALANCE

Use the LOAD_BALANCE parameter to enable or disable client load balancing for multiple protocol addresses.

RECV_BUF_SIZE

Use the RECV_BUF_SIZE parameter to specify, in bytes, the buffer space for receive operations of sessions. This parameter is supported by the TCP/IP, TCP/IP with SSL, and SDP protocols.

SDU

Use the parameter SDU to instruct Oracle Net to optimize the transfer rate of data packets being sent across the network with the session data unit (SDU) size you specify.

SEND_BUF_SIZE

Use the parameter SEND_BUF_SIZE to specify, in bytes, the buffer space for send operations of sessions. This parameter is supported by the TCP/IP, TCP/IP with SSL, and SDP protocols.

SOURCE_ROUTE

Use the parameter SOURCE_ROUTE to enable routing through multiple protocol addresses.

TYPE_OF_SERVICE

Use the parameter TYPE_OF_SERVICE parameter to specify the type of service to use for an Oracle Rdb database. This parameter should only be used if the application supports both an Oracle Rdb and Oracle database service, and you want the application to load balance between the two.

net_service_name=

(DESCRIPTION=

(ADDRESS_LIST=

(ADDRESS=(PROTOCOL=tcp)(HOST=sales1-server)(PORT=1521)

(RECV_BUF_SIZE=11784))

(ADDRESS=(PROTOCOL=tcp)(HOST=sales2-server)(PORT=1521)

(RECV_BUF_SIZE=11784))

(CONNECT_DATA=

(SERVICE_NAME=sales.us.example.com)))

net_service_name=

(DESCRIPTION=

(RECV_BUF_SIZE=11784)

(ADDRESS_LIST=

(ADDRESS=(PROTOCOL=tcp)(HOST=hr1-server)(PORT=1521)

(ADDRESS=(PROTOCOL=tcp)(HOST=hr2-server)(PORT=1521))

(CONNECT_DATA=

(SERVICE_NAME=hr.us.example.com)))

CONNECT_DATA

Use the CONNECT_DATA parameter to define the service to which to connect.

CONNECT_DATA permits the following subparameters:

FAILOVER_MODE

Use the FAILOVER_MODE parameter to instruct Oracle Net to fail over to a different listener if the first listener fails during run-time. Depending upon the configuration, session or any SELECT statements which were in progress are automatically failed over.

GLOBAL_NAME

Use the GLOBAL_NAME parameter to identify the Oracle Rdb database.

HS

Use the HS parameter to instruct Oracle Net to connect to a non-Oracle system through Heterogeneous Services.

INSTANCE_NAME

Use the INSTANCE_NAME parameter to identify the database instance to access. Set the value to the value specified by the INSTANCE_NAME parameter in the initialization parameter file.

RDB_DATABASE

Use the RDB_DATABASE parameter to specify the file name of an Oracle Rdb database.

SERVER

Use the SERVER parameter to instruct the listener to connect the client to a specific type of service handler.

SERVICE_NAME

Use the SERVICE_NAME parameter to identify the Oracle9i or Oracle8 database service to access. Set the value to a value specified by the SERVICE_NAMES parameter in the initialization parameter file.

SID

Use the SID parameter to identify the Oracle8 database instance by its Oracle System Identifier (SID). If the database is Oracle9i or Oracle8, use the SERVICE_NAME parameter rather than the SID parameter.

net_service_name=

(DESCRIPTION=

(ADDRESS=...)

(ADDRESS=...)

(CONNECT_DATA=

(SID=sales)))

Security Section

The security section of the tnsnames.ora file specifies the following security-related parameters for use with Oracle Advanced Security features:

SECURITY

Use the SECURITY parameter to enable secure connections.

net_service_name=

(DESCRIPTION=

(ADDRESS=(PROTOCOL=tcp)(HOST=sales1-svr)(PORT=1521))

(ADDRESS=(PROTOCOL=tcp)(HOST=sales2-svr)(PORT=1521))

(CONNECT_DATA=

(SERVICE_NAME=sales.us.example.com))

(SECURITY=

(SSL_SERVER_CERT_DN="cn=sales,cn=OracleContext,dc=us,dc=example,dc=com")))

SSL_SERVER_CERT_DN

Use the SSL_SERVER_CERT_DN parameter to specify the distinguished name (DN) of the database server. The client uses this information to obtain the list of DNs it expects for each of the servers, enforcing the database server DN to match its service name.

No comments:

Post a Comment

Followers