Search This Blog

Sunday, September 23, 2012

Oracle RAC 11gR2 Client Side TAF.

TYPE: TAF supports three types of failover types

1.SESSION failover - If a user's connection is lost, SESSION failover establishes a new session 
automatically created for the user on the backup node. This type of failover does not attempt 
to recover selects. This failover is ideal for OLTP (online transaction processing) systems, 
where transactions are small.

2.SELECT failover – If the connection is lost, Oracle Net establishes a connection to another 
node and re-executes the SELECT statements with cursor positioned on the row on which it was 
positioned prior to the failover. This mode involves overhead on the client side and Oracle 
NET keeps track of SELECT statements. This approach is best for data warehouse systems, 
where the transactions are big and complex

3.NONE: This setting is the default and no failover functionality is provided. Use this setting to
 prevent failover.




METHOD

BASIC: Use this mode to establish connections at failover time, no work on the backup server until failover time.

PRECONNECT: Use this mode to pre-established connections. This PRECONNECT mode provides faster failover 
but requires that the backup instance be capable of supporting all connections from every supported instance.

RETRIES: Use this parameter to specify number of times to attempt to connect to attain a failover. If DELAY is 
specified but RETRIES is not specified, RETRIES default to five retry attempts.

DELAY: Use this parameter to Specify the amount of time in seconds to wait between connect attempts. If RETRIES 
is specified but DELAY is not specified, DELAY default to one second.



EXAMPLE:

Configure DNS Resolution on client side.

Insert DNS server location in the "/etc/resolv.conf" file.


[root@client ~]# cat /etc/resolv.conf

search example.com
nameserver 192.168.1.100

Verify

[root@client ~]# nslookup rac-cluster-scan
Server:         192.168.1.100
Address:        192.168.1.100#53

Name:   rac-cluster-scan.example.com
Address: 192.168.1.152
Name:   rac-cluster-scan.example.com
Address: 192.168.1.150
Name:   rac-cluster-scan.example.com
Address: 192.168.1.151



Create tnsnames.ora file.

whenever a database is created using dbca, Sample tnsnames entry are created on each 
node in the tnsnames.ora file.
Those entries can be used to configure client.

Sample Tns entry in case of BASIC connection.




DELL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac-cluster-scan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = dell.example.com)
      (FAILOVER_MODE= (TYPE=select)(METHOD=basic)(RETRIES=10)(DELAY=5))
    )
  )




Connect on client

[root@client ~]# su - oracle
[oracle@client ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Sun Sep 23 21:21:22 2012

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

SQL> conn scott/tiger@dell
Connected.

Check on RAC cluster

SQL>  select inst_id,sid,username,failover_type,failover_method,failed_over from gv$session where username='SCOTT';

   INST_ID        SID USERNAME                       FAILOVER_TYPE FAILOVER_M FAI
---------- ---------- ------------------------------ ------------- ---------- ---
         1         55 SCOTT                          SELECT        BASIC      NO



Sample Tns entry in case of Preconnect connection.



DATA1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac-cluster-scan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = dell.example.com)
      (INSTANCE_NAME=dell1)
      (FAILOVER_MODE= (BACKUP=DATA2)(TYPE=select)(METHOD=preconnect))
    )
  )

DATA2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac-cluster-scan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = dell.example.com)
      (INSTANCE_NAME=dell2)
      (FAILOVER_MODE= (BACKUP=DATA1)(TYPE=select)(METHOD=preconnect))

    )
  )


Connect from client side.


[oracle@client admin]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Sun Sep 23 22:12:46 2012

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

SQL> conn scott/tiger@data1
Connected.

Check on RAC cluster.

SQL>  select inst_id,sid,username,failover_type,failover_method,failed_over from gv$session where username='SCOTT';

   INST_ID        SID USERNAME                       FAILOVER_TYPE FAILOVER_M FAI
---------- ---------- ------------------------------ ------------- ---------- ---
         1         53 SCOTT                          SELECT        PRECONNECT NO
         2         60 SCOTT                          NONE          NONE       NO









0 comments:

Post a Comment