oracle 11.2.0.4及以上
某客户需要实现service-side taf,在创建service后,sqlplus下执行shutdown immediate关闭1个节点进行failover测试时,发现service无法failover。
sqlplus下关闭1节点实例
日志显示service failover connot be completed
这是预期的行为,在mos文档:11gr2 rac service not failing over to other node when instance is shut down (doc id 1324574.1)中,有对各版本不同关闭实例方式service的行为进行了说明。
如果使用sqlplus关闭实例:
(1)11.2.0.4之前的版本, service将failover到available实例
(2)11.2.0.4及以后的版本,service不会failover,而是stop
如果使用srvctl关闭实例:
(1)11.2之前, service将failover到available实例
(2)11.2版本, service将不会failover,而是stop
针对srvctl关闭实例,从12c开始又有变化:
(1)如果停止实例没有-force或-failover参数,且有服务在该实例上运行,会报错(prcd-1315,prcr-1014, prcr-1065, crs-2529)
$ srvctl stop instance -d -i
prcd-1315 : failed to stop instances for database
prcr-1014 : failed to stop resource ora..db
prcr-1065 : failed to stop resource ora..db
crs-2529: unable to act on 'ora..db' because that would require stopping or relocating 'ora.._test01.svc', but the force option was not specified
(2)如果只有-force参数,service将不会failover,而是stop
srvctl status service -d -s _test01
service _test01 is running on instance(s)
$ srvctl stop instance -d -i -force
$ srvctl status service -d -s _test01
service _test01 is not running.
(3)有-force和-failover参数,service将failover到available实例
$ srvctl status service -d
service _test01 is running on instance(s)
$ srvctl stop instance -d -i -failover -f
$ srvctl status service -d
service _test01 is running on instance(s)
通过思维导图展示如下:
在11.2中,当使用srvctl停止实例时,如果想要服务failover到available实例
(1)指定-f参数
srvctl stop instance -d xxx -i xxx1 -f
(2)停止实例之前通过srvctl relocate service将服务切换到另一个实例
srvctl relocate service -d -s _test01 -i -t
11gr2 rac service not failing over to other node when instance is shut down (doc id 1324574.1)