The driver supports the following types of failover for connections established using the TNSNAMES.ORA file:
  • Connection failover
  • Extended connection failover
For details, see "Connection failover" and "Extended connection failover".

To configure connection and extended connection failover using the TNSNAMES.ORA file, set the following parameters in the TNSNAMES.ORA file:

net_service_primary=
(DESCRIPTION=
(FAILOVER=on)
(ADDRESS=PROTOCOL=TCP)(HOST=hostname_primary)(PORT=portnumber_primary))
(ADDRESS=PROTOCOL=TCP)(HOST=hostname_alternate)(PORT=portnumber_alternate))
(CONNECT_DATA=
(FAILOVER_MODE=
(BACKUP=net_service_alternate)
(TYPE=session)
(RETRIES=number_of_retries)
(DELAY=delay_time)
(METHOD=basic))
(SERVICE_NAME = ASC)
)
)

where:

net_service_primary
specifies the name of the net service that contains the parameters required for configuring failover.
hostname_primary
specifies the name or IP address of the primary server to which the driver attempts to connect.
portnumber_primary
specifies the port number of the primary server listener.
hostname_alternate
specifies the name or IP address of the alternate server. If the attempt to connect to the primary server fails, the driver attempts to connect to the alternate server.
portnumber_alternate
specifies the port number of the alternate server listener.
net_service_alternate
specifies the name of the net service that provides the alternate server details for supporting extended connection failover.
number_of_retries

specifies the number of times the driver attempts to connect to the specified servers after the initial unsuccessful connection attempt. In each attempt, the driver first tries to connect to the primary server and then to the alternate server.

delay_time
specifies the amount of time in seconds that the driver has to wait for before reattempting to connect to the specified servers. In each attempt, the driver first tries to connect to the primary server and then to the alternate server.

The following example shows how to configure connection and extended connection failover using the TNSNAMES.ORA file.

NetService1=
(DESCRIPTION =
(FAILOVER=on)
(ADDRESS=PROTOCOL=TCP)(HOST=server3)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=server4)(PORT=1521))
(CONNECT_DATA=
(FAILOVER_MODE=
(BACKUP=NetService2)
(TYPE=session)
(RETRIES=2)
(DELAY=5)
(METHOD=basic))
(SERVICE_NAME=ASC)
)
)