Server Side Transparent Application Failover for Oracle RAC

Concepts & Overview 

The TAF setting on a service overrides any TAF settings in the client connection definition that might be configured in TNS connect descriptors. If the failover type is set on the server side, then the failover method will default to BASIC.

Oracle Call Interface applications with TAF enabled should use FAN high availability events for fast connection failover ( FCF ).

TAF is a feature of the OCI driver, and TAF cannot be used with thin driver

There are two types of TAF available, SESSION and SELECT.

SESSION: Session Failover re-creates the connections and sessions to the surviving instance.
SELECT: In addition to recreating the session, Select Failover also replays the queries that were in progress.

There are two methods in which TAF estabilishes the failover connection, BASIC and PRECONNECT.

BASIC: The second connection is re-established only after the first connection to the instance failed.
PRECONNECT: Two connections are established when the client logs in to the database. A login to database will create two connection at the same time. For this to work, clusterware actually starts two services. One main service and another shadow service.

The tests are held under the environment as below,  both 11gR2 database and client are used to test the behaviours of server side TAF by using SCAN.

GI: 12.1.0.2.0
4 nodes RAC: 11.2.0.4
Oracle Client: 11.2.0.4

The service name is RAC_TEST running on preferred nodes node1 and node4, while available nodes are node2 and node3.

$ srvctl status service -s RAC_TEST -d TESTDB

Service RAC_TEST is running on instance(s) TESTDB1,TESTDB4

Steps for testing server side TAF

1) create a service if not yet, here we modify it because the service has already existed

$ srvctl modify service -s RAC_TEST -d TESTDB -P BASIC -e SELECT -m BASIC -w 120 -z 5

2) start the service if not yet

$ srvctl start service -s RAC_TEST -d TESTDB

3) check service is running

$srvctl status service -s RAC_TEST -d TESTDB
Service RAC_TEST is running on instance(s) TESTDB1,TESTDB4

4) check service from database query

SQL>col name format a15
col failover_method format a11 heading ‘METHOD’
col failover_type format a10 heading ‘TYPE’
col failover_retries format 9999999 heading ‘RETRIES’
col goal format a10
col clb_goal format a8
col AQ_HA_NOTIFICATIONS format a5 heading ‘AQNOT’

SQL> select name, failover_method, failover_type, failover_retries,goal, clb_goal,aq_ha_notifications from dba_services where name=’RAC_TEST’;

NAME METHOD TYPE RETRIES GOAL CLB_GOAL AQNOT
————— ———– ———- ——– ———- ——– —–
RAC_TEST BASIC SELECT 5 NONE LONG NO

5) create a service name into TNS entry

SERVER_TAF =
(DESCRIPTION = (LOAD_BALANCE = YES )
(ADDRESS = (PROTOCOL = TCP)(HOST =CLU-SCAN)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = RAC_TEST)
)
)

6) make a connection to database by using above TNS entry

SQL> connect jamesh@server_taf
Enter password:
Connected.
SQL> select host_name,instance_name from v$instance;

HOST_NAME INSTANCE_NAME
—————————————————————- —————-
racnode4
TESTDB4

SQL> select INST_ID,sid,serial#,USERNAME,FAILOVER_TYPE,FAILOVER_METHOD,FAILED_OVER,status  from gv$session where username=’JAMESH’;

INST_ID SID SERIAL# USERNAME TYPE METHOD FAI STATUS
———- ———- ———- ———— ———- ———– — ——–
4 380 4569 JAMESH SELECT BASIC NO INACTIVE

7) Shutdown the instance or the service on the node the connection has made to
SQL> select host_name,instance_name from v$instance;

HOST_NAME INSTANCE_NAME
—————————————————————- —————-
racnode1 TESTDB1

SQL>select INST_ID,sid,serial#,USERNAME,FAILOVER_TYPE,FAILOVER_METHOD,FAILED_OVER,status from gv$session where username=’JAMESH’;

INST_ID SID SERIAL# USERNAME TYPE METHOD FAI STATUS
——— ———- ———- ———— ———- ———– — ——–
1 250 971 JAMESH SELECT BASIC YES INACTIVE

Advertisements
This entry was posted in GI and RAC and tagged , , , , , . Bookmark the permalink.

One Response to Server Side Transparent Application Failover for Oracle RAC

  1. Pingback: Transparent Application Failover for Oracle RAC | Oracle RAC Goldengate

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s