11.2 RAC实例关闭的时候服务不漂移到另一个节点

11.2 RAC实例关闭的时候服务不漂移到另一个节点


范围
11.2.0.2及以后的版本,所有平台


症状
‘srvctl stop instance’关闭了实例但是服务没有故障转移到可用节点。
在11.2之前的版本,通过srvctl或sqlplus关闭实例会触发服务转移到可用节点。


1)在GRB数据库上创建优先节点一的服务grb_stest01
srvctl add service -d GRB -s grb_stest01 -r GRB1 -a GRB2


2)检查服务是否被创建
srvctl config service -d GRB -a
==>
Service name: grb_stest01
Service is enabled
Server pool: GRB_grb_stest01
Cardinality: 1
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: NONE
Preferred instances: GRB1
Available instances: GRB2
Service name: grb_test01
Service is enabled
Server pool: GRB_grb_test01
Cardinality: 1
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: NONE
Preferred instances: GRB1
Available instances:


3)开始grb_stest01服务
srvctl start service -d GRB -s grb_stest01


4)确认服务在节点一上运行
srvctl status service -d GRB
==>
Service grb_stest01 is running on instance(s) GRB1


5)使用immediate或abort关闭实例
srvctl stop instance -d GRB -i GRB1
OR
srvctl stop instance -d GRB -i GRB1 -o abort

srvctl status service -d GRB
==>
Service grb_stest01 is not running
可见服务没有漂移但是停止了。


变更
升级到11.2


原因
11.2应当的行为
使用sqlplus关闭实例,在10g和11g中都会漂移。
使用srvctl关闭实例,在11.2以前的版本会漂移,在11.2,服务不会漂移而是关闭。
在11.2,想要服务漂移的话你需要加上-f选项(如,srvctl stop instance -d xxx -i xxx1 -f)。
或者,在关闭实例之前手动漂移服务。
srvctl relocate service -d exdb -s testsv -i exdb1 -t exdb2


解决办法
加-f选项
srvctl stop instance -d GRB -i GRB1 -f
srvctl status service -d GRB
==>
Service grb_stest01 is running on instance(s) GRB2


在12c里,语法、行为改变了。
1)关闭的实例上运行着服务的时候,不加-force或-failover选项会报错,如下:
$srvctl config service -d orcl -s orcl_service01

Service name: orcl_service01
...
....
Preferred instances: orcl1
Available instances: orcl2

$srvctl status service -d orcl
Service orcl_service01 is running on instance(s) orcl1

$ srvctl stop instance -d orcl -i orcl1
PRCD-1315 : failed to stop instances for database orcl
PRCR-1014 : Failed to stop resource ora.orcl.db
PRCR-1065 : Failed to stop resource ora.orcl.db
CRS-2529: Unable to act on 'ora.orcl.db' because that would require stopping or relocating 'ora.orcl.orcl_service01.svc', but the force option was not specified


2)想让服务漂移,你需要加-failover选项而不是-force,如下:
$ srvctl status service -d orcl
Service orcl_service01 is running on instance(s) orcl1
$ srvctl stop instance -d orcl -i orcl1 -failover
$ srvctl status service -d orcl
Service orcl_service01 is running on instance(s) orcl2


3)不想让服务漂移,你需要加-force,如下:
srvctl status service -d orcl -s orcl_service01
Service orcl_service01 is running on instance(s) orcl1
$ srvctl stop instance -d orcl -i orcl1 -force
$ srvctl status service -d orcl -s orcl_service01
Service orcl_service01 is not running.

你可能感兴趣的:(11.2 RAC实例关闭的时候服务不漂移到另一个节点)