1. 程式人生 > >文件 ID 1324574.1 11gR2 RAC 服務在例項關閉時不會故障轉移到其他節點

文件 ID 1324574.1 11gR2 RAC 服務在例項關閉時不會故障轉移到其他節點

11gR2 RAC Service Not Failing Over To Other Node When Instance Is Shut Down (文件 ID 1324574.1)
11gR2 RAC 服務在例項關閉時不會故障轉移到其他節點

Oracle Database - Enterprise Edition - Version 11.2.0.2 and later
Information in this document applies to any platform.

一、現象

'srvctl stop instance'使例項關閉,但服務沒有故障轉移到可用例項
在11.2之前,通過srvctl/sqlplus停止例項觸發服務故障切換到可用例項

1) 在GRB DB上建立名為“grb_test01”的服務,GRB1是首選例項,GRB2是可用例項

srvctl add service -d GRB -s grb_stest01 -r GRB1 -a GRB2

2) 檢查service的建立

srvctl config service -d GRB -a         11.2.0.4中棄用-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) 確認服務正在GRB1上執行
srvctl status service -d GRB

==>
Service grb_stest01 is running on instance(s) GRB1
5) 使用srvctl imemediate(預設)或 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
此時服務不會故障轉移,但服務會停止。

二、CHANGES

Upgrade to 11.2

三、原因

這是11.2中的預期行為

如果使用sqlplus關閉例項
在10g,11g中,服務將會故障切換到可用例項

如果使用srvctl關閉例項
在11.2之前,服務將故障切換到可用例項。
在11.2中,服務不會故障轉移,但服務會停止

在11.2中,在使用srvctl停止例項時,如果希望服務故障轉移(在另一個例項中啟動)到可用例項需要指定-f選項(即srvctl stop instance -d xxx -i xxx1 -f)。

或者,您可以在通過srvctl停止例項之前將服務重定位到另一個例項  srvctl relocate service -d exdb -s testsv -i exdb1 -t exdb2

四、 解決方案

將-f選項與srvctl配合使用,以使服務在關閉例項時故障切換到可用例項。

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選項,然而有service執行在正在停止的例項上時會報錯(PRCD-1315,PRCR-1014, PRCR-1065, CRS-2529)

ie)
$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”
ie)
$ 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) 如果要停止的例項上執行著例項和AND服務,請使用“-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.
引用:
Oracle Real Application Clusters Administration and Deployment Guide
11g Release 2 (11.2)
Part Number E16795-08

-----------------------------
srvctl stop instance