11grac配置failover

Posted liang-ning

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了11grac配置failover相关的知识,希望对你有一定的参考价值。

配置基于服务端的TAF:

一.客户端配置

客户端tns配置:

racdb =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST=192.168.59.172)(PORT=1521))
(ADDRESS = (PROTOCOL = TCP)(HOST=192.168.59.173)(PORT=1521))
)
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDTICATED)
(SERVICE_NAME = test)
)
)

ip为vip。

2、服务器端配置

1)使用Oracle用户,为CRS配一个service资源

用命令配service

语法:#srvctl add service -d <database-name> -s <service-name> -r "preferred-instance-list" -a "available-instance-list" -P <TAF-policy>

[oracle@rac1 ~]$ srvctl add service -d test -s TAF -r "test1,test2" -P BASIC

[oracle@rac1 ~]$ srvctl config service -d test   查看TAF服务状态
Service name: TAF
Service is enabled
Server pool: test_TAF
Cardinality: 2
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: BASIC
Edition:
Preferred instances: test1,test2
Available instances:
[oracle@rac1 ~]$

 

2)启动服务

[oracle@rac1 ~]$ srvctl start service -d test -s TAF  启动TAF服务

[oracle@rac1 ~]$ crs_stat -t |grep svc
ora....taf.svc ora....ce.type ONLINE ONLINE rac1   看到TAF服务资源已启动

SQL> show parameter service

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string TAF

 3.配置数据库里的服务信息:

begin

dbms_service.modify_service (

service_name => ‘TAF‘,

failover_type => dbms_service.failover_type_select,

failover_method => dbms_service.failover_method_basic,

failover_retries => 180,

failover_delay => 5 );

end;

/

查看视图,确认服务器端实例双活,监听正常

set linesize 150

col name for a10;

col FAILOVER_METHOD for a20;

col FAILOVER_TYPE for a20;

select NAME,FAILOVER_METHOD,FAILOVER_TYPE,FAILOVER_RETRIES,FAILOVER_DELAY  from ALL_SERVICES where NAME=‘TAF‘;

NAME FAILOVER_METHOD FAILOVER_TYPE FAILOVER_RETRIES FAILOVER_DELAY
---------- -------------------- -------------------- ---------------- --------------
TAF BASIC SELECT 180 5

4)切换测试(使用scott用户测试

SQL>alter user scott identified by scott account unlock;

SQL>grant select on v_$instance to scott;

客户端登录

 

sqlplus scott/scott@racdb   客户端用Scott用户测试

select instance_name,status from v$instance;


INSTANCE_NAME STATUS
---------------- ------------
test1 OPEN

目前显示连接的是一节点,我们关闭一节点网卡。

[root@rac1 ~]# ifconfig eth0 down

SQL> select instance_name,status from v$instance;

 

 

 

 

INSTANCE_NAME STATUS
---------------- ------------
test2OPEN

SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL>
SQL>

我们发现客户端已经无痕切换到另外一个节点。这样,我们就配置成功了基于服务端的failover。

 

 

以上是关于11grac配置failover的主要内容,如果未能解决你的问题,请参考以下文章

oracle11gRAC+DG主库增加数据文件

CentOS7搭建Oracle11gRAC问题汇总

对oracle10grac配置em

管理11gRAC基本命令 (转载) 很详细

安装oracle11grac时使用asmlib和udev的区别

安装 Oracle 11g RAC(空集群节点)时出现问题 INS-35423