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. This article describes the Failover based on Oracle 10g RAC and the TAF mode on the client and provides an example.
The following are some reference links for this purpose:
For load balancing and Oracle service configurations, see
Oracle RAC Listener Configuration (listener. ora tnsnames. ora)
Non-Default port listening configuration in Oracle RAC (listener. ora tnsnames. ora)
Load Balance)
Oracle RAC server connection Load Balance)
Oracle RAC load balancing test (combined with server and client)
For Oracle RAC failover connection failover, refer
Oracle RAC failover test (Failover during connection)
Oracle RAC failover test (server TAF Mode)
1. TAF description # The following official description of TAF from Oracle: Id 453293.1 transparent application Failover (TAF) is a feature of the Oracle call interface (OCI) driver at client side. it enables the application to automatically reconnect to a database, if the database instance to which the connection is made fails. in this case, the active transactions roll back. tnsnames parameter: failover_mode when an instance to which a Conn Ection is established fails or is shutdown, the connection on the client side becomes stale and wocould throw exceptions to the caller trying to use it. TAF enables the application to transparently reconnect to a preconfigured secondary instance creating a fresh connection, but identical to the connection that was established on the first original Instance. # Simply put, for clients that have successfully connected to a specific instance, if the instance or node is abnormal The client automatically resends the connection # request to the remaining instance. So that the client does not feel that the instance or node it is connected to has a fault, this is called transparent transfer. However, the active transactions will be rolled back. # Configure failover_mode in tnsnames. ora of the client to implement the taf2, server, and client environment # server environment, host information Oracle @ bo2dbp: ~> CAT/etc/hosts | grep VIP 192.168.7.61 bo2dbp-vip.2gotrade.com bo2dbp-vip 192.168.7.62 bo2dbs-vip.2gotrade.com bo2dbs-vip # server environment, cluster information Oracle @ bo2dbp: ~>. /Crs_stat.sh Resource Name target State -------------- ------ ----- ora. gobo4.gobo4a. inst offline on bo2dbp # at this time, the instance on node 1 is disabled ora. gobo4.gobo4b. inst online on bo2dbs ora. gobo4.db online on bo2dbp ora. bo2dbp. asm1.asm online on bo2dbp ora. bo2dbp. listener_bo2dbp.lsnr online on bo2dbp ora. bo2dbp. listener_ora10g_bo2dbp.lsnr online on bo2dbp ora. bo2dbp. GSD online o Nline on bo2dbp ora. bo2dbp. ONS online on bo2dbp ora. bo2dbp. VIP online on bo2dbp ora. bo2dbs. asm2.asm online on bo2dbs ora. bo2dbs. listener_bo2dbs.lsnr online on bo2dbs ora. bo2dbs. listener_ora10g_bo2dbs.lsnr online on bo2dbs ora. bo2dbs. GSD online on bo2dbs ora. bo2dbs. ONS online on bo2dbs ora. bo2dbs. VIP online on bo2dbs ora. ora10g. DB online onlin E on bo2dbp # client environment Robin @ szdb: ~> CAT/etc/issue welcome to SuSE Linux Enterprise Server 10 SP3 (x86_64)-kernel \ r (\ L). Robin @ szdb: ~> Sqlplus-v SQL * Plus: Release 10.2.0.3.0-production # client tnsnames configuration gobo4_taf = (description = (address = (Protocol = TCP) (host = 192.168.7.61) (Port = 1521 )) (address = (Protocol = TCP) (host = 192.168.7.62) (Port = 1521) (load_balance = yes) (CONNECT_DATA = (Server = dedicated) (SERVICE_NAME = gobo4) (failover_mode = # failover_mode parameter (type = session) (method = Basic) (retries = 180 (delay = 5 ))) 3. failover_mode item analysis the failover_mode item is the main configuration content for implementing TAF, which is described below. method: You can define when to create a connection to your instance. There are two optional values: basic and preconnect: after the client successfully establishes a connection through the address list, that is, if the client detects a node failure, it creates a connection to another instance. preconnect: the pre-connection mode is used to establish a connection to all instances at the same time when a connection is established, when a fault occurs, you can immediately switch to another link. The above two methods have their own advantages and disadvantages. The former has a relatively low connection overhead, but the Failover will produce a delay, the latter is exactly the opposite of the former type: used to define how to handle the completed SQL statement in the event of a fault. There are two types: Session and select: select, oracle Net will track all the select statements during the transaction, and track that each cursor related to the current select has returned multiple Send less lines to the client. In this case, if row 500 is returned for the SELECT query and the node currently connected to the client fails, Oracle Net automatically establishes a connection to the surviving instance and continues to return the remaining number of lines to the client. Assume that the total number of rows is 1500, And the rows are returned from the remaining nodes. Session: When session is used, all the results related to the SELECT query will be lost after a new connection is created. You need to re-release the SELECT command. The preceding two methods are applicable to different situations. For select methods, they are usually used with OLAP databases, while for session methods, they are used with OLTP databases. Because of the select method, Oracle must save more content for each session, including the cursor and user context, and require more resources. Second, during the two modes, all uncommitted DML transactions will be automatically rolled back and must be restarted and started. The alter session statement does not failover. Temporary objects cannot be failover or restarted. Retries: indicates the number of retries. Delay: indicates the Retry Interval. 4. Test TAF # The connection is established for the first time. At this time, the client establishes a connection from the first IP address configured by tnsnames, because the instance where the first VIP is located is closed, the hostname and instance_name corresponding to 192.168.7.62 # VIP 192.168.7.62 are bo2dbs and gobo4b respectively, so we get the following returned result # Second, we can see the related parameter Robin @ szdb of the current session failover: ~> Sqlplus fail_over/fail @ gobo4_taf fail_over @ gobo4> Get verify. SQL 1 rem the following query is for TAF connection verification 2 Col Sid format 99999 3 Col serial # format 9999999 4 Col failover_type format A13 5 Col failover_method format A15 6 Col failed_over format A11 7 prompt 8 prompt failover status for current user 9 prompt ============================== =============== 10 select Sid, 11 serial #, 12 failover_type, 13 failover_method, 14 failed_over 15 from V $ session 16 Where username = 'fail _ over '; 17 REM the following query is for Load Balancing verification 18 Col host_name format A20 19 prompt 20 prompt current instance name and host name 21 prompt ========== =========================================== 22 * select instance_name, host_name from V $ instance; 23 fail_over @ gobo4> @ verify failover status For current user ========================================== ======= Sid serial # failover_type failover_method failed_over ------ -------- --------------- ----------- 1063 1175 session basic no current instance name and host name ============== ========================== instance_name host_name ---------------------------------- gobo4b bo2dbs # start the first instance gobo4a, and stop the second instance Oracle @ bo2dbp: ~> Srvctl start instance-D gobo4-I gobo4a Oracle @ bo2dbp: ~> Srvctl stop instance-D gobo4-I gobo4b # view the status of the two instances Oracle @ bo2dbp: ~>. /Crs_stat.sh | grep inst ora. gobo4.gobo4a. inst online on bo2dbp ora. gobo4.gobo4b. inst offline # Check the connection status again in the client session, that is, execute the query. The result is as follows, we received the ORA-25408 fail_over @ gobo4> @ verify failover status for current user ================== ============================= select Sid, * error at line 1: ORA-25408: can not safely replay call current instance name and host name ============================ ===== ====== Instance_name host_name ---------------- ------------------------ gobo4a bo2dbp # re-execute the query. At this time, the client has automatically reconnected and the instance_name and host_name returned from the query are known. # The most important value of failed_over is yes, indicating that the current session is a session from a failover. # For methods using preconnect and type using select, fail_over @ gobo4> @ verify failover status for current user ============ ============================ Sid serial # failover_type failover_method failed_over ------------------------------------------ ----------- 1073 29 session basic Yes current instance name and host name ========================== ============== instance_name host_name -------------- -- -------------------- Gobo4a bo2dbp # Author: Robinson # blog: http://blog.csdn.net/robinson_0612 5, summary: A, client TAF mode to achieve the Oracle client to the server transparent failover B, mainly in the client tnsnames. ora configures failover_mode to implement client-based taf c and failover_mode. Connection-based methods can be divided into basic and preconnect. The latter has higher overhead and lower latency, in contrast to the former, type in D and failover_mode can be divided into two modes: select and session. All the uncommitted transactions of both modes are rolled back. The select method will perform a Failover query and the session method will not. The select method is mostly used in OLAP databases, while the session method is mostly used in OLTP database E. Once the instance in which the session is located fails, it will automatically fail and no manual reconnection is required, this is different from the Failover during connection.
More references
For more information about Oracle RAC, see
Use crs_setperm to modify the resource owner and permissions of RAC.
Use crs_profile to manage RAC resource configuration files
RAC database startup and Shutdown
Oracle RAC services
Services in Oracle Database 10g
Migrate datbase from single instance to Oracle RAC
Connect Oracle RAC to a specified instance
Oracle RAC load balancing test (combined with server and client)
Oracle RAC server connection Load Balance)
Load Balance)
Non-Default port listening configuration in Oracle RAC (listener. ora tnsnames. ora)
Oracle RAC Listener Configuration (listener. ora tnsnames. ora)
Configure RAC load balancing and Failover
CRS-1006, CRS-0215 fault case
Installing Oracle 10g RAC Based on Linux (RHEL 5.5)
Use runcluvfy to verify the Oracle RAC installation environment
For more information about the basics and concepts of Oracle network configuration, see:
Configure dynamic service registration for non-default ports
Configure sqlnet. ora to restrict IP Access to Oracle
Configure and manage Oracle listener logs
Set the Oracle listener password (listener)
Configure the Oracle client to connect to the database
For more information about user-managed backup and recovery, see
Oracle cold backup
Oracle Hot Backup
Concept of Oracle backup recovery
Oracle instance recovery
Oracle recovery based on user management
System tablespace management and Backup Recovery
Sysaux tablespace management and recovery
Oracle backup control file recovery (unsing backup controlfile)
For information on RMAN backup recovery and management, see
RMAN overview and architecture
RMAN configuration, Monitoring and Management
Detailed description of RMAN backup
RMAN restoration and recovery
Create and use RMAN catalog
Create RMAN storage script based on catalog
Catalog-based RMAN backup and recovery
RMAN backup path confusion
Use RMAN for recovery from different machine backups (WIN platform)
Use RMAN to migrate a file system database to ASM
Linux RMAN backup shell script
Use RMAN to migrate the database to a different machine
For the Oracle architecture, see
Oracle tablespace and data files
Oracle Password File
Oracle parameter file
Oracle online redo log file)
Oracle Control File)
Oracle archiving logs
Oracle rollback and undo)
Oracle database instance startup and Shutdown Process
Automated Management of Oracle 10g SGA
Oracle instances and Oracle databases (Oracle Architecture)