# Oracle Database - Connect Descriptor (TNS Connect String)

The Connect Descriptor (known also as TNS Connect String) is a type of connect identifier. It defines the parameters that need the Oracle Net Service to connect to a database service :

• the protocol
• the host
• the port
• the SID
• the database connection type

You can gives a connect descriptor:

• manually The Connect descriptor must be given in 1 line or you have to use single quote. See here for more information on the syntax: connect identifier syntax.
• or through different mechanisms named naming method.

## 3 - Syntax

A connect descriptor is comprised of one or more protocol addresses of the listener and the connect information for the destination service.

(DESCRIPTION=
(CONNECT_DATA=
(SID=sales)
(SERVICE_NAME=sales.us.example.com)
(INSTANCE_NAME=sales))
(SERVER=shared)))
)

where

• the ADDRESS section contains the following:
• PROTOCOL parameter, which identifies the listener protocol address. The protocol is tcp for TCP/IP.
• HOST parameter, which identifies the host name. The host is sales-server.
• PORT parameter, which identifies the port. The port is 1521, the default port number.
• The CONNECT_DATA section contains the following:
• SID parameter, which identifies the SID of the Oracle database. The SID is sales.
• SERVICE_NAME parameter, which identifies the service. The destination service name is a database service named sales.us.example.com.
• INSTANCE_NAME parameter, which identifies the database instance. The instance name is optional.
• SERVER parameter which identifies the service handler type where the parameter value can be

## 4 - Database connection type

If shared server is configured in the initialization parameter file, you can select Dedicated Server to force the listener to spawn a dedicated server, bypassing shared server configuration. If shared server is configured in the initialization parameter file and you want to guarantee the connection always uses shared server, select Shared Server.

## 5 - Enhancing Service Accessibility using Multiple Listeners

For some configurations, such as Oracle Real Application Clusters, multiple listeners on multiple nodes can be configured to handle client connection requests for the same database service. In the following example, sales.us.example.com can connect using listeners on either sales1-server or sales2-server.

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

A multiple-listener configuration also enables you to leverage the failover and load balancing features, either individually or in combination with each other. The following topics describe the features:

• Connect-time Failover
• Transparent Application Failover

## 6 - How to get the TNS connect string ?

You can get the connect string by performing a tnsping on the tnsname.

C:\Documents and Settings\Nicolas>tnsping orcl

TNS Ping Utility for 32-bit Windows: Version 10.2.0.4.0 - Production on 10-JUN-2009 11:09:18

Used parameter files:
C:\Documents and Settings\Nicolas>tnsping qsdb > c:\tns.txt
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ngerard)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = QSDB)))