In Oracle RAC, in addition to the TAF Method Based on the client, there is also the TAF Method Based on the server. You can regard the TAF method of the server as an upgraded version of the TAF method of the client. The TAF of the server must be configured on the server. This is done through the Service. This article describes how to configure the server-side TAF in Oracle 10g rac through service.
1. server and client Environments
# Server environment and 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 and cluster information
Oracle @ bo2dbp: ~> ./Crs_stat.sh
Resource name Target State
-------------------------
Ora. GOBO4.GOBO4A. inst ONLINE on bo2dbp
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 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 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 =
(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 = TAF) # Pay Attention to the SERVICE_NAME of our client. We set it to TAF.
)
)
2. Configure the service on the server
There are multiple methods to configure the service, such as dbca, oem, and srvctl command lines. The following is a command line configuration.
Oracle @ bo2dbp: ~> Srvctl add service-d GOBO4-s TAF-r GOBO4A-a GOBO4B-P basic
Oracle @ bo2dbp: ~> Srvctl start service-d GOBO4-s TAF
Oracle @ bo2dbp: ~> ./Crs_stat.sh | grep TAF
Ora. GOBO4.TAF. GOBO4A. srv ONLINE on bo2dbp
Ora. GOBO4.TAF. cs ONLINE on bo2dbp
Oracle @ bo2dbp: ~> Srvctl config service-d GOBO4-
Taf pref: GOBO4A AVAIL: GOBO4B TAF: basic
Oracle @ bo2dbp: ~> Export ORACLE_SID = GOBO4A
Oracle @ bo2dbp: ~> Sqlplus/as sysdba
SQL * Plus: Release 10.2.0.3.0-Production on Mon Dec 17 14:55:02 2012
Copyright (c) 1982,200 6, Oracle. All Rights Reserved.
Connected:
Oracle Database 10g Release 10.2.0.3.0-64bit Production
With the Real Application Clusters option
SQL> show parameter service
NAME TYPE VALUE
-----------------------------------------------------------------------------
Service_names string SYS $ SYS. KUPC $ s_20172012102317304
4. GOBO4, SYS $ SYS. KUPC $ c_00002012
1023173044. GOBO4, GOBO4, TAF
SQL> begin
2 dbms_service.modify_service (
3 service_name => 'taf ',
4 failover_method => dbms_service.failover_method_basic,
5 failover_type => dbms_service.failover_type_select,
6 failover_retries => 180,
7 failover_delay => 5 );
8 end;
9/
PL/SQL procedure successfully completed.
SQL> select name, failover_method, failover_type, goal, clb_goal from dba_services
2 where name = 'taf ';
NAME FAILOVER_METHOD FAILOVER_TYPE GOAL CLB_G
------------------------------------------------------------------------
TAF BASIC SELECT LONG
SQL> ho lsnrctl status
..........
Service "TAF" has 1 instance (s ).
Instance "GOBO4A", status READY, has 2 handler (s) for this service...
The command completed successfully
3. Test the server-side TAF
Robin @ SZDB: ~> Sqlplus fail_over/fail @ gobo4
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
# The following connection query indicates that the client is currently connected to the node bo2dbp, and its instance name is GOBO4A
Fail_over @ GOBO4> @ verify
Failover status for current user
========================================================== ====
Sid serial # FAILOVER_TYPE FAILOVER_METHOD FAILED_OVER
-----------------------------------------------------
1073 48 SELECT BASIC NO
Current instance name and host name
==========================================================
INSTANCE_NAME HOST_NAME
------------------------------------
GOBO4A bo2dbp
# Stop node bo2dbp at this time
Oracle @ bo2dbp: ~> Srvctl stop instance-d GOBO4-I GOBO4A
# View the result of stopping node bo2dbp, that is, after instance GOBO4A
Oracle @ bo2dbp: ~> ./Crs_stat.sh | grep inst
Ora. GOBO4.GOBO4A. inst OFFLINE
Ora. GOBO4.GOBO4B. inst ONLINE on bo2dbs
# Return to the client and run the query again. The value of FAILED_OVER has changed to YES, indicating that the current session is from failover.
# At the same time, the Instance name and node name have also changed
Fail_over @ GOBO4> set timing on;
Fail_over @ GOBO4> @ verify
Failover status for current user
========================================================== ====
Sid serial # FAILOVER_TYPE FAILOVER_METHOD FAILED_OVER
-----------------------------------------------------
1082 396 SELECT BASIC YES
Elapsed: 00:00:04. 19
Current instance name and host name
==========================================================
INSTANCE_NAME HOST_NAME
------------------------------------
GOBO4B bo2dbs
Elapsed: 00:00:00. 01
4. Summary
A. failover in the TAF mode on the server side is completed by configuring the service on the server side
B. The TAF method on the server side has the same effect as the TAF method on the client side.
B. Once the server-side TAF is configured on the server end, the client no longer needs to add the FAILOVER_MODE item on the client end.
C. This method simplifies client configuration and implements failover through centralized and unified service management.
Oracle video tutorial follow: http://u.youku.com/user_video/id_UMzAzMjkxMjE2.html