当前位置:Gxlcms > mysql > OracleRACfailover测试(ServerTFA方式)

OracleRACfailover测试(ServerTFA方式)

时间:2021-07-01 10:21:17 帮助过:30人阅读

Oracle RAC中,除了基于客户端的TFA方式之外,还有基于服务器端的TFA方式,可以把服务端的TFA方式看作是客户端TFA方式的一个升级

Oracle RAC中,除了基于客户端的TFA方式之外,还有基于服务器端的TFA方式,可以把服务端的TFA方式看作是客户端TFA方式的一个升级版吧。服务器端的TFA,当然是需要在服务器端进行配置了,这个是通过Service来完成的。本文主要描述Oracle 10g rac 下通过service方式配置服务器端的TFA。

下面是一些关于这方面的基础参考链接:

有关负监听配置,载均衡(load balance)请参考

ORACLE RAC 下非缺省端口监听配置(listener.ora tnsnames.ora)

Oracle RAC 客户端连接负载均衡(Load Balance)

Oracle RAC 服务器端连接负载均衡(Load Balance)

Oracle RAC 负载均衡测试(结合服务器端与客户端)

1、服务器端、客户端的环境
#服务器端环境,host信息
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

#服务器端环境,,集群信息
oracle@bo2dbp:~> ./crs_stat.sh
Resource name Target State
-------------- ------ -----
ora.GOBO4.GOBO4A.inst ONLINE ONLINE on bo2dbp
ora.GOBO4.GOBO4B.inst ONLINE ONLINE on bo2dbs
ora.GOBO4.db ONLINE ONLINE on bo2dbp
ora.bo2dbp.ASM1.asm ONLINE ONLINE on bo2dbp
ora.bo2dbp.LISTENER_BO2DBP.lsnr ONLINE ONLINE on bo2dbp
ora.bo2dbp.LISTENER_ORA10G_BO2DBP.lsnr ONLINE ONLINE on bo2dbp
ora.bo2dbp.gsd ONLINE ONLINE on bo2dbp
ora.bo2dbp.ons ONLINE ONLINE on bo2dbp
ora.bo2dbp.vip ONLINE ONLINE on bo2dbp
ora.bo2dbs.ASM2.asm ONLINE ONLINE on bo2dbs
ora.bo2dbs.LISTENER_BO2DBS.lsnr ONLINE ONLINE on bo2dbs
ora.bo2dbs.LISTENER_ORA10G_BO2DBS.lsnr ONLINE ONLINE on bo2dbs
ora.bo2dbs.gsd ONLINE ONLINE on bo2dbs
ora.bo2dbs.ons ONLINE ONLINE on bo2dbs
ora.bo2dbs.vip ONLINE ONLINE on bo2dbs
ora.ora10g.db ONLINE ONLINE on bo2dbp

#客户端环境
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

#客户端tnsnames配置
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 = TFA) #注意我们客户端的SERVICE_NAME,我们设置为TFA
)
)

2、在服务器端配置service
配置service有多种方式,如dbca,oem,srvctl命令行。下面直接以命令行方式配置
关于什么是service以及如何使用srvctl命令行创建service,请参考:
oracle@bo2dbp:~> srvctl add service -d GOBO4 -s TFA -r GOBO4A -a GOBO4B -P basic
oracle@bo2dbp:~> srvctl start service -d GOBO4 -s TFA
oracle@bo2dbp:~> ./crs_stat.sh | grep TFA
ora.GOBO4.TFA.GOBO4A.srv ONLINE ONLINE on bo2dbp
ora.GOBO4.TFA.cs ONLINE ONLINE on bo2dbp
oracle@bo2dbp:~> srvctl config service -d GOBO4 -a
TFA 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, 2006, Oracle. All Rights Reserved.

Connected to:
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_1_2012102317304
4.GOBO4, SYS$SYS.KUPC$C_1_2012
1023173044.GOBO4, GOBO4, TFA

SQL> begin
2 dbms_service.modify_service(
3 service_name=>'TFA',
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 FAILOVER_METHOD FAILOVER_TYPE GOAL CLB_G
-------------------- -------------------- --------------- ------------ -----
TFA BASIC SELECT LONG

SQL> ho lsnrctl status
..........
Service "TFA" has 1 instance(s).
Instance "GOBO4A", status READY, has 2 handler(s) for this service...
The command completed successfully

linux

人气教程排行