To provide the failover capabilities in an Oracle RAC environment, configure the Oracle connection string in the tnsnames.ora file to use Oracle TAF.
To enable failover, enter multiple virtual listener addresses in the tnsnames.ora file for the RAC database configuration. The first address is used for the initial connection. As shown in the following code segment, when a failure occurs, the connections between the ECDA Option for Oracle and the Oracle database try to reconnect to the subsequent virtual listener address entries until a connection is successful.
RACDB=
(DESCRIPTION=
(ADDRESS =(PROTOCOL = TCP)(HOST = host1)(PORT = 1521))
(ADDRESS =(PROTOCOL = TCP)(HOST = host2)(PORT = 1521))
(ADDRESS =(PROTOCOL = TCP)(HOST = host3)(PORT = 1521))
(ADDRESS =(PROTOCOL = TCP)(HOST = host4)(PORT = 1521)) )
In addition, you must add the FAILOVER_MODE section to the Oracle connection string. This section has two configuration parameters that define the failover characteristics for a connection:
TYPE, which has two options:
SELECT keeps track of any select statements issued in the current transaction and replays them after the failover connection is reestablished. Sybase recommends that you use this option.
SESSION establishes a new connection only to the backup instance, and all work is lost.
METHOD, which also has two options:
BASIC establishes a new connection to the backup instance only when the primary connection fails. Sybase recommends that you use this option.
PRECONNECT establishes a connection to the backup instance when the primary connection is made, reducing failover time. However, for every connection, two connections are created, so more resources are used.
This code segment shows the two recommended FAILOVER_MODE options:
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb.sybase.com)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
) )
This code segment shows an example of the Oracle connection string combining the earlier code segments in the tnsnames.ora file with all of the configuration parameters set to enable failover:
RACDB=
(DESCRIPTION=
(ADDRESS =(PROTOCOL = TCP)(HOST = host1)(PORT = 1521))
(ADDRESS =(PROTOCOL = TCP)(HOST = host2)(PORT = 1521))
(ADDRESS =(PROTOCOL = TCP)(HOST = host3)(PORT = 1521))
(ADDRESS =(PROTOCOL = TCP)(HOST = host4)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb.sybase.com)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
)
)
)