Client Configuration TAF in 11g RAC Environment

Source: Internet
Author: User
Tags failover reserved taf sqlplus

TAF is the transparent application failover abbreviation, as the name implies is the application of transparent failover, for example, when the application to connect an Oracle database to perform query operations, the database server network interruption or instance crashes, After the values set by the delay parameter are automatically connected to other available instances, the query continues. (provided that the execution plan, the order of the output result set and the output cannot be changed)

Characteristics of Taf:
1:taf is a feature provided by Oracle clients that uses TAF to have certain requirements for the client's environment, such as the Java JDBC Driver, the Oracle client version, etc. (8i begins to support Taf);
2: Roughly TAF can be divided into 2 kinds, when the TAF and the words are connected and TAF after the establishment;
3:TAF itself is independent of whether the RAC environment, but generally used in the RAC environment, minimize the impact of the most applications, single instance environment can also use TAF, so that the use of Pl/sql Developer Connection database, even if the database instance restart, do not need to reconnect;
4:rac environment, the TAF can also be configured on the server side;
5: TAF will be disabled after configuring the Global_dbname parameters for the Listener.ora file.

The configuration is as follows:

1, view the service side of the service_name and RAC scan address:

[oracle@rac122 tnslsnr]$ cat/etc/hosts # Don't remove the following line, or various programs # this require network
Ctionality would fail.  127.0.0.1               localhost.localdomain localhost:: 1             LOCALHOST6.LOCALDOMAIN6 Localhost6 #Public 10.1.252.121            rac121 10 .1.252.122            rac122 #Private 192.168.123.1           RAC12 1-priv 192.168.123.2           Rac122-priv #Virtual IP 10.1.252.75         & nbsp    RAC121-VIP 10.1.252.76             RAC122-VIP 10.1.252.68             Rac-scan [oracle@rac122 tnslsnr]$ sqlplus/as sysdba sql*plus:release 11.2.0.3.0 Production on Tue June 2 6 15:33:29 Copyright (c) 1982, Oracle.

 all rights reserved. Connected to:oracle Database 11g EnterPrise Edition release 11.2.0.3.0-64bit Production with the partitioning, real application clusters, Automatic Storage Ma Nagement, OLAP, Data Mining and real application testing Options sql> show parameter service_name name                                 TYPE     &NBSP ;  value-----------------------------------------------------------------------------service_names   
                      string      RACDB sql> 

2. Add the following content to the client Tnsnames.ora file:

RACDB = (DESCRIPTION = (Address_list = (address = (PROTOCOL = TCP) (HOST = 10.1.252.68) (PORT = 1521)) (Connect_data = (service_name = racdb) (Failover_mode = (TYPE = SELECT) (METH OD = BASIC) (retries = 180) (DELAY = 5)))

Attribute Description:
The Type Type property describes the types of failover, and the possible values are as follows:
session specifies that when a failover occurs, TAF should create sessions without performing any other actions.
Select specifies that, in addition to creating a session, TAF should restart any SELECT statements that are run during failover, when performing a failover.
When the SELECT statement is executed, ORACLE Net returns a row that was not returned to the user before the failover.
None does not perform TAF failover
The method method feature determines when the session is created, and the possible values are as follows:
BASIC creates a session during a failover
After the Preconnect is established with the initial connection to the database, a failover session is created with the Oracle NET alias specified by the backup attribute.
The retries retries attribute refers to the number of times that Oracle Net returns address_list and attempts to connect to the surviving instance.
DELAY DELAY attribute Specifies the number of waits between retries


3, with the client login for the following operations:

C:\Documents and Settings\ ' ' >sqlplus/nolog sql*plus:release 10.2.0.1.0-production on Tuesday June 15:00:56 Ight (c) 1982, +, Oracle.

 all rights reserved.
Sql> Conn SYS/SYSTEM@RACDB as SYSDBA is connected. Sql> Show parameter instance_name name                      typ E VALUE--------------------------------------------------------------instance_name     & nbsp
      String racdb2 sql> select Sid from V$mystat where Rownum=1;        SID----------       163 sql> Select Machine,failover_type,failover_me
Thod,failed_over from V$session where sid=163; MACHINE failover_type       failover_method       FAILED----------------------- -----------------------------ailk\tanwei SELECT              BASIC & nbsp               NO sql> CREATE TABLE taf_client_test (ID int,vname varchar2 (10));
Table has been created.
sql> INSERT INTO taf_client_test values (1, ' Taf ');
1 lines have been created.
sql> update taf_client_test set id=5;
1 rows have been updated.
Sql> select * from Taf_client_test;
         ID vname------------------------------         5 TAF

4, update not commit, stop RACDB2 instance:

[oracle@rac122 tnslsnr]$ srvctl status instance-d racdb-i racdb2 instance RACDB2 is
running on node rac122
[Orac le@rac122 tnslsnr]$ srvctl Stop instance-d racdb-i racdb2-o abort
[oracle@rac122 tnslsnr]$-Srvctl Status Instance-  D racdb-i racdb2
Instance racdb2 are not running on node rac122
[oracle@rac122 tnslsnr]$ srvctl status instance-d Racdb-i racdb1
Instance racdb1 is running on node rac121-there is also a node at work


5, back to the client for the following operations:

Sql> select * from Taf_client_test;


SELECT * FROM Taf_client_test * Line 1th Error: ORA-25402: Transaction processing must be rerun sql> rollback;


Fallback is complete.


Sql> select instance_name from V$instance;  instance_name--------------------------------racdb1 sql> show parameter instance_name NAME                type            value----------------   ----- -------- -----------instance_name       string          RACDB1--found automatically switch to node
1, sql> select * from Taf_client_test;


No rows selected sql> select * from V$mystat where rownum=1;        sid statistic#      value------------------------------       166          0          0 sql> Select Failover_type,failover_

Method,failed_over from V$session where sid=166; Failover_type               Failover_method      failed----------------------------------------------------SELECT     & nbsp
               BASIC                yes

This completes the configuration and validation of the TAF.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.