[Oracle] TAF for RACfailover Switching

Source: Internet
Author: User
Tags taf
Fault transfer (failover) of the OracleRAC client. When the TAF method is adopted, the client does not need to be used when the connected instance or node fails.

Oracle RAC client failover (failover). When the TAF method is adopted, the client does not need

Oracle RAC client failover (failover). When using the TAF method, the client that has established a connection does not need to send a connection request again when the connected instance or node fails, the previous database operations can still be continued, which is called transparent failover.

To use TAF, You need to configure the client tnsnames. ora file. The failover_mode option is added to the file. failover = on is the default configuration. Do not write it.

Today's test verifies the difference between type = select and type = session.

These two parameters are used to roll back the transaction when the instance crashes. The difference is that the select statement is being executed when the node crashes. Type = select transfers the executed select statement to the new node and continues to return the subsequent result set. type = session terminates the query, to perform this query again, you need to run the select statement again and perform the query from the beginning.

Assume that the user is performing a query on node 1, and there are a total of 100 records in the result set. Now 10 records have been returned from node 1, and node 1 is down, the user connection is transferred to node 2. In session mode, the query statement needs to be re-executed. In select mode, the remaining 90 days of records will be returned from node 2, 10 records that have been returned from node 1 will not be returned to the user again. For the user, the switch cannot be felt.

Obviously, in order to implement the select method, Oracle must save more content for each session, including the cursor and user context. More resources are required to change the time of resources.

Start the experiment below

I. type = select

The tnsnames configuration is as follows:

RACDB =

(Description =

(Address = (protocol = tcp) (host = 192.168.1.201) (port = 1521 ))

(Address = (protocol = tcp) (host = 192.168.1.202) (port = 1521 ))

(Load_balance = yes)

(Connect_data =

(Server = dedicated)

(Service_name = RACDB)

(Failover_mode =

(Type = select)

(Method = preconnect)

(Retries = 180)

(Delay = 5)

)

)

)

Lab started:

Connect to RAC, view the instance_name at this time, and run the query statement.

[Oracle @ jp admin] $ sqlplus sys/oracle @ RACDB as sysdba

SQL * Plus: Release 10.2.0.1.0-Production on Wed Mar 5 06:17:10 2014

Copyright (c) 1982,200 5, Oracle. All rights reserved.

Connected:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-Production

With the Partitioning, Real Application Clusters, OLAP and Data Mining options

SYS @ RACDB> show parameter instance_name

NAME TYPE VALUE

-----------------------------------------------------------------------------

Instance_name string RACDB1

SYS @ RACDB> select * from dba_objects;

...........

During execution, the RACDB1 shutdown abort Simulation Node crashes.

SYS @ RACDB1> shutdown abort

ORACLE instance shut down.

After the query is stuck for a few seconds, the query results are returned without re-running the query statement.

Ii. type = session

The configuration of tnsnames. ora is as follows:

RACDB =

(Description =

(Address = (protocol = tcp) (host = 192.168.1.201) (port = 1521 ))

(Address = (protocol = tcp) (host = 192.168.1.202) (port = 1521 ))

(Load_balance = yes)

(Connect_data =

(Server = dedicated)

(Service_name = RACDB)

(Failover_mode =

(Type = session)

(Method = preconnect)

(Retries = 180)

(Delay = 5)

)

)

)

Lab started

SYS @ RACDB> show parameter instance_name

NAME TYPE VALUE

-----------------------------------------------------------------------------

Instance_name string RACDB2

SYS @ RACDB> select * from dba_objects;

Omitted ......

In this case, the RACDB2 shutdown abort

SYS @ RACDB2> shutdown abort

ORACLE instance shut down.

In this case, the query is stuck. An error is reported in a few seconds and the number of queried rows is displayed.

ERROR:

ORA-25401: can not continue fetches

750 rows selected.

SYS @ RACDB>

Query instance_name

SYS @ RACDB> show parameter instance_name

NAME TYPE VALUE

-----------------------------------------------------------------------------

Instance_name string RACDB1

It has been automatically switched to RACDB1, but the query statement has been interrupted.

The TAF client also includes some other parameters:

Method = perconnect/basic

Basic: connects to other nodes only when a fault occurs on the current node.

Perconnect: the connection is established to all instances when the connection is initially established. If the current node fails, you can quickly switch to another instance.

The difference between the two parameters is that the current node has an error, and the duration of conversion to other nodes is long. Although perconnect is fast, it also consumes some additional resources, in other words, you can change the speed of resources. You can determine the trade-off based on the actual situation.

Load_blance = on/off

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.