Saturday, 28 December 2013

TRANSPARENT APPLICATION FAILOVER(TAF) WITH SCAN IN 11GR2

TRANSPARENT APPLICATION FAILOVER WITH SCAN

Transparent Application Failover is process by which the sessions are automatically failover to the other available instance in the cluster database. New connection would be point to the available instance on the cluster database and if you have any active transaction and it will be rollback to the last committed transaction.

TRANSPARENT APPLICATION FAILOVER (TAF) FAILOVER METHODS
(METHOD = BASIC/PRECONNECT)

BASIC FAILOVER

The second connection to the available instance is made only if and when the primary instance is down or disconnected for some reason.

PRECONNECT FAILOVER

The Second connection to another available instance is made at the same time as the connection to the primary instance. Having the backup connection already in place can reduce the time needed for a failover in the event that one needs to take place. We have considered the Over Head while the sessions are pre-connected.

TRANSPARENT APPLICATION FAILOVER (TAF) FAILOVER TYPE 
(TYPE=SESSION/SELECT/NONE)

SESSION
When the TYPE= Session specified, it will failover to the available instance in the cluster database and it doesn’t continue with selected, if it is in the process. OCI will start the select process again.SELECT
When the type=select specified, it will failover to the available instance in the cluster database and the failover process also replays the queries that is in the progress.
NONE
No failover function is used. When you specify it as none, no failover function will be used.

TAF can be configured at the Oracle Client side in tnsnames.ora or at the Database Server side using "srvctl"

SRVCTL SYNTAX FOR CREATING SERVICE

srvctl add service -d -s   -r "" [-a ""] [-P {BASIC | NONE | PRECONNECT}]
 -g [-c {UNIFORM | SINGLETON}]
 [-k ]
 [-l [PRIMARY][,PHYSICAL_STANDBY][,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]]
 [-y {AUTOMATIC | MANUAL}]
 [-q {TRUE|FALSE}]
 [-x {TRUE|FALSE}]
 [-j {SHORT|LONG}]
 [-B {NONE|SERVICE_TIME|THROUGHPUT}]
[-e {NONE|SESSION|SELECT}]
        -- This defines the type of TAF whether SESSION or SELECT.
[-m {NONE|BASIC}]
        --This defines the method of TAF.
[-z ]
        -- the number of times to attempt to connect after a failover.
[-w ]
        -- the amount of time in seconds to wait between connect attempts.



SYNTAX

           srvctl add service -d -s
           -r "" [-a ""] [-P {BASIC | NONE | PRECONNECT}]
          [-e {NONE|SESSION|SELECT}]
          [-m {NONE|BASIC}]
          [-z ]
          [-w ]

 
srvctl modify service -d orcl -s orcldb -r node1,node2 -P basic -e select -m basic -z 10 -w 2

 -d = database name
 -s = service name we want to modify
 -r = preferd node list where this service is running
 -a = available nodes - this we haven't given
 -P = is type which can be BASIC | NONE | PRECONNECT
 -e = is type i.e SELECT or SESSION
 -z = Failover restries
 -w = Failover delay
 -m = defines the method of TAF.
 Reference MOS note -

11gR2(11.2) RAC TAF Configuration for Admin and Policy Managed Databases [ID 1312749.1]

PRECONNECT USING SCAN NAMES

When you are connecting using the scan names and having the failover method as PRE-CONNECT then you use should configured with the (preferred instance & available instance).

Ex:

orcl =
  (description =
   (address = (protocol=tcp)(host=orclrac-scan)(port=1521))
   (connect_data=
     (service_name=orclrac)
     (failover_mode= (backup=orclrac_preconnect)
       (type=select) (method=preconnect)
     )
   ) )

orclrac_preconnect =
  (description =
   (address = (protocol=tcp)(host=orclrac-scan)(port=1521))
   (connect_data=(service_name=orclrac_preconnect))
  )

BASIC USING SCAN NAMES

SCAN provides load balancing and failover for client connections to the database. The SCAN works as a cluster alias for databases in the cluster.


orclrac =
  (description =
   (address = (protocol=tcp)(host=orclrac-scan)(port=1521))
   (connect_data=(service_name=orclrac))
  )

TRADITIONAL METHOD
 
JDBC connection

ORCL=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=ora01)(Port=1521)) (ADDRESS=(PROTOCOL=TCP)(HOST=ora02)(PORT = 1521))
(CONNECT_DATA=(SERVICE_NAME=ORCLRAC)(FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC))))

TNS ENTRY

ORCL=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(Host=ora01)(Port=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=ora02)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=ORCLRAC)
(FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC))))

Start the service
$ srvctl start service -d -s


Stop the service
 $ srvctl stop service -d -s


To Modify the service
$ srvctl modify service -d -s

To see the configuration of the service
$ srvctl config service -d -s


To see the Connection of the pre-connect session
select inst_id,username,service_name,failover_type, failover_method,failed_over from gv$session where username='ORCL';

No comments:

Post a Comment