Transparent Application Failover (TAF) is a client-side feature that allows for clients to reconnect to surviving databases in the event of a failure of a database instance.
1.Notifications are used by the server to trigger TAF callbacks on the client-side.2.TAF is configured using either client-side specified TNS connect string or using server-side service attributes. However, if both methods are used to configure TAF, the server-side service attributes will supersede the client-side settings. The server-side service attributes are the preferred way to set up TAF.
3.TAF can operate in one of two modes, Session Failover and Select Failover. Session Failover will re-create lost connections and sessions. Select Failover will replay queries that were in progress.
4.TAF automatically restores some or all of the following elements associated with active database connections.
5.TAF automatically reestablishes the connection using the same connect string or an alternate connect string that you specify when configuring failover.
6.TAF automatically logs a user in with the same user ID as was used prior to failure. If multiple users were using the connection, then TAF automatically logs them in as they attempt to process database commands.
7.TAF allows applications that began fetching rows from a cursor before failover to continue fetching rows after failover. This is called "select" failover.
8.Any active transactions are rolled back at the time of failure because TAF cannot preserve active transactions after failover.
9.Server-side program variables, such as PL/SQL package states, are lost during failures; TAF cannot recover them.
TAF Configuration on Client side:
A backup connection can be pre-established. The initial and backup connections must be explicitly specified.
In Example, clients that use net service name taftest1 to connect to the listener on or-11 are also preconnected to or-12. If or-11 fails after the connection, Oracle Net fails over to or-12, preserving any SELECT statements in progress.
TAFTEST1 =(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp) (HOST=or-11) (PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=rac)(INSTANCE_NAME=rac1)
(FAILOVER_MODE= (BACKUP=TAFTEST2)(TYPE=select)(METHOD=preconnect)))
)
################################
TAFTEST2 =(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp) (HOST=or-12) (PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=rac)(INSTANCE_NAME=rac2)
(FAILOVER_MODE=(BACKUP=TAFTEST2)(TYPE=select)(METHOD=preconnect)))
)
TAF Verification Query
You can query FAILOVER_TYPE, FAILOVER_METHOD, and FAILED_OVER columns in the V$SESSION view to verify that TAF is correctly configured.
SELECT MACHINE, FAILOVER_TYPE, FAILOVER_METHOD, FAILED_OVER, COUNT(*)
FROM V$SESSION
GROUP BY MACHINE, FAILOVER_TYPE, FAILOVER_METHOD, FAILED_OVER;
TAF Configuration on Server side:
When you check the service configuration you find no values for failover methodCreating a service
srvctl add service -d rac -s server_taf -r "rac1,rac2" -P BASIC
Start the service
srvctl start service -d rac -s server_taf
Checking that the services are running.
srvctl config service -d rac
ractest PREF: rac1 rac2 AVAIL:
server_taf PREF: rac1 rac2 AVAIL:
Getting the service ID value
sqlplus /nolog
Connect / as sysdba
SQL> select name,service_id from dba_services where name = 'server_taf';
NAME SERVICE_ID
--------------------------------
server_taf 6
Checking the setup
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 service_id = 6
NAME METHOD TYPE RETRIES GOAL CLB_GOAL AQ_HA_NOT
--------------- ----------- ---------- -------- ---------- -------- -----
server_taf LONG NO
Adding the server side failover parameter to the service
Server side TAF method is BASIC. BASIC is the only value currently supported. This means that a new connection is established at failure time. It is not possible to pre-establish a backup connection. (which is to say, PRECONNECT is not supported)
SQL> execute dbms_service.modify_service (service_name => 'server_taf' -
, aq_ha_notifications => true -
, failover_method => dbms_service.failover_method_basic -
, failover_type => dbms_service.failover_type_select -
, failover_retries => 180 -
, failover_delay => 5 -
, clb_goal => dbms_service.clb_goal_long);
PL/SQL procedure successfully completed.
Check that the service can now see the values for methods, types and retries
SQL>select name, failover_method, failover_type, failover_retries,goal, clb_goal,aq_ha_notifications
from dba_services where service_id = 6
NAME METHOD TYPE RETRIES GOAL CLB_GOAL AQ_HA_NOT
--------------- ----------- ---------- -------- ---------- -------- -----
server_taf BASIC SELECT 180 NONE LONG YES
Check that the listener has the service registered
lsnrctl services
Create a net service name. Here we have client load balancing between the two nodes.
SERVERTAF =
(DESCRIPTION =
(LOAD_BALANCE = yes)
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1.cluster.us.oracle.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = rac2.cluster.us.oracle.com)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = server_taf.rac.oracle.com)
No comments:
Post a Comment