Saturday, July 6, 2013

TAF WITH SCAN IN 11GR2

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 ]


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:

Bhuvan =
  (description =
   (address = (protocol=tcp)(host=bhuvanrac-scan)(port=1521))
   (connect_data=
     (service_name=bhuvanrac)
     (failover_mode= (backup=bhuvanrac_preconnect)
       (type=select) (method=preconnect)
     )
   ) )

bhuvanrac_preconnect =
  (description =
   (address = (protocol=tcp)(host=bhuvanrac-scan)(port=1521))
   (connect_data=(service_name=bhuvanrac_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.

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

TRADITIONAL METHOD


JDBC connection

BHUVAN=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)
(Host=bhuora01)(Port=1521)) (ADDRESS=(PROTOCOL=TCP)
(HOST=bhuora02)(PORT = 1521))
(CONNECT_DATA=(SERVICE_NAME=BHUVANRAC)
(FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC))))

TNS ENTRY

BHUVAN=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(Host=bhuora01)(Port=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=bhuora02)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=BHUVANRAC)
(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='BHUVAN';

No comments:

Post a Comment