ACS-HBR-SAPHanaRestorationAutomationByExistingECS SAP HANA備份可用性驗證(恢復到已有實例)
模板描述
在已有的兩臺SAP HANA實例(源實例和目的實例),通過HBR服務將源實例備份數據恢復到目的實例,并檢查恢復后的目的實例狀態立即執行
模板類型
自動化
所有者
Alibaba Cloud
輸入參數
參數名稱 | 描述 | 類型 | 是否必填 | 默認值 | 約束 |
vaultId | HBR備份庫ID | String | 是 | ||
sourceClusterId | HBR源實例Id | String | 是 | ||
destinationClusterId | HBR目的實例Id | String | 是 | ||
HANASID | 目的實例SAP HANA SID | String | 是 | 字符串校驗正則表達式 : ^[A-Z][A-Z0-9][A-Z0-9]$ | |
ECSHostname | 目的實例主機名 | String | 是 | 字符串校驗正則表達式 : ^([a-zA-Z0-9] | |
HANAInstanceNumber | 目的實例SAP HANA實例編號 | String | 是 | 字符串校驗正則表達式 : ^([0-8][0-9] | |
dingTalkWebhook | 釘釘機器人Webhook地址 | String | 是 | ||
databaseName | 數據庫實例列表 | List | 否 | ['SYSTEMDB@:SYSTEMDB'] |
輸出參數
無
執行此模板需要的權限策略
{
"Version": "1",
"Statement": [
{
"Action": [
"hbr:CreateHanaRestore",
"hbr:DescribeClients",
"hbr:DescribeHanaBackupSetting",
"hbr:DescribeHanaBackupsAsync",
"hbr:DescribeHanaRestores",
"hbr:DescribeTask",
"hbr:UpdateHanaBackupSetting"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"ecs:DescribeInvocationResults",
"ecs:DescribeInvocations",
"ecs:RunCommand"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"oos:ListExecutions"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
詳情
ACS-HBR-SAPHanaRestorationAutomationByExistingECS詳情
模板內容
FormatVersion: OOS-2019-06-01
Description:
en: 'This template uses existing SAP HANA instances(source instance and destination instance) to restore the source instance backup data to the destination instance through the HBR service, and check the restored destination instance status.'
zh-cn: 在已有的兩臺SAP HANA實例(源實例和目的實例),通過HBR服務將源實例備份數據恢復到目的實例,并檢查恢復后的目的實例狀態
name-en: ACS-HBR-SAPHanaRestorationAutomationByExistingECS
name-zh-cn: SAP HANA備份可用性驗證(恢復到已有實例)
Parameters:
vaultId:
Label:
zh-cn: HBR備份庫ID
en: Backup Vault ID
Description:
zh-cn: 備份庫的Id
en: Backup vault ID
Type: String
sourceClusterId:
Label:
zh-cn: HBR源實例Id
en: Source SAP HANA instance ID
Description:
zh-cn: '源實例Id, 需要恢復的SAP HANA備份實例的Id,請在云備份控制臺-ECS應用備份-實例名稱/Id一欄查看。'
en: 'Source SAP HANA instance ID, can be found in the Cloud Backup Console - ECS Application Backup - Instance Name/ID.'
Type: String
destinationClusterId:
Label:
zh-cn: HBR目的實例Id
en: Destination SAP HANA instance ID
Description:
zh-cn: '目的實例Id, 測試的SAP HANA備份的實例Id,請在云備份控制臺-ECS應用備份-實例名稱/Id一欄查看。'
en: 'Destination SAP HANA instance ID, can be found in the Cloud Backup Console - ECS Application Backup - Instance Name/ID.'
Type: String
databaseName:
Label:
zh-cn: 數據庫實例列表
en: SAP HANA Database List
Description:
zh-cn: 需要恢復備份的SAP HANA數據庫實例列表,格式:<源數據庫名>@<SID>:<目的數據庫名>,多個數據庫實例請以換行分隔
en: SAP HANA database list in format of "<Source SAP HANA database name>@<Source SAP HANA system Id>". Separate multiple SAP HANA database with line breaks
Type: List
Default:
- 'SYSTEMDB@<SID>:SYSTEMDB'
HANASID:
Type: String
ConstraintDescription:
zh-cn: '必須輸入3個字符,可包含大寫字母或數字,首位必須是大寫字母。'
en: '3 characters,can including capital letter or number, must starting with capital letter.'
Label:
zh-cn: 目的實例SAP HANA SID
en: SAP HANA SID
Description:
zh-cn: 目的實例SAP HANA SID
en: Destination instance SAP HANA SID
AllowedPattern: '^[A-Z][A-Z0-9][A-Z0-9]$'
ECSHostname:
Type: String
Label:
zh-cn: 目的實例主機名
en: Hostname
Description:
zh-cn: 目的實例主機名
en: SAP HANA ECS hostname
AllowedPattern: '^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-])*([a-zA-Z0-9])$'
ConstraintDescription:
zh-cn: 長度為 2-13 個字符,允許使用大小寫字母、數字或連字符(-),但不能以連字符(-)開頭或結尾
en: 'The length is 2-13 characters,can starting with a capital or lowercase letter,and can contain numbers,or -,but can''t starting with - or end with -.'
HANAInstanceNumber:
Type: String
Label:
zh-cn: 目的實例SAP HANA實例編號
en: SAP HANA Instance Number
Description:
zh-cn: 目的實例SAP HANA實例編號
en: SAP HANA instance number
ConstraintDescription:
zh-cn: 2位數字,00-97
en: '2 numbers,00-97.'
AllowedPattern: '^([0-8][0-9]|9[0-6])$'
dingTalkWebhook:
Label:
zh-cn: 釘釘機器人Webhook地址
en: DingTalk Robot Webhook
Description:
zh-cn: '釘釘自定義機器人Webhook地址,用以向釘釘發送測試結果消息和刪除云資源審批消息,更多請瀏覽<a href=''https://open-doc.dingtalk.com/microapp/serverapi2/qf2nxq'' target=''_blank''>釘釘自定義機器人</a>。'
en: 'Sends notification to DingTalk via webhook for asking approval. The execution remains paused until approved or rejected. Please refer https://open-doc.dingtalk.com/microapp/serverapi2/qf2nxq for details.'
Type: String
Tasks:
- Name: checkHanaBackupSetting
Action: 'ACS::CheckFor'
Description:
zh-cn: 查詢源實例SAP HANA數據庫備份設置
en: Check source SAP HANA backup settings
Properties:
Service: HBR
API: DescribeHanaBackupSetting
Parameters:
VaultId: '{{ vaultId }}'
ClusterId: '{{ sourceClusterId }}'
DatabaseName:
'Fn::Select':
- 0
- 'Fn::Split':
- '@'
- '{{ ACS::TaskLoopItem }}'
PropertySelector: HanaBackupSetting.CatalogBackupUsingBackint
DesiredValues:
- true
Retries: 2
Loop:
Items: '{{ databaseName }}'
RateControl:
MaxErrors: 0
Mode: Concurrency
Concurrency: 1
- Name: checkForActivateClient
Action: 'ACS::CheckFor'
OnError: getExecutionFaildMessage
Description:
zh-cn: 檢查客戶端是否為激活狀態
en: Check for client status(activated)
Properties:
Service: HBR
API: DescribeClients
Parameters:
ClusterId: '{{ destinationClusterId }}'
VaultId: '{{ vaultId }}'
SourceType: HANA
ClientType: ECS_AGENT
PropertySelector: 'Clients.Client[].Status'
DesiredValues:
- ACTIVATED
Retries: 2
Outputs:
ClientId:
Type: String
ValueSelector: 'Clients.Client[].ClientId'
InstanceId:
Type: String
ValueSelector: 'Clients.Client[].InstanceId'
- Name: RestoreBuckup
Action: 'ACS::HBR::RestoreHanaDatabaseBackup'
OnError: getExecutionFaildMessage
Description:
zh-cn: 恢復并驗證備份
en: Restore and verify backup
Properties:
vaultId: '{{ vaultId }}'
sourceClusterId: '{{ sourceClusterId }}'
sourceSystemName:
'Fn::Select':
- 0
- 'Fn::Split':
- ':'
- '{{ ACS::TaskLoopItem }}'
clusterId: '{{ destinationClusterId }}'
databaseName:
'Fn::Select':
- 1
- 'Fn::Split':
- ':'
- '{{ ACS::TaskLoopItem }}'
HANAInstanceServerId: '{{ checkForActivateClient.InstanceId }}'
HANASID: '{{ HANASID }}'
masterClientId: '{{ checkForActivateClient.ClientId }}'
Loop:
Items: '{{ databaseName }}'
RateControl:
MaxErrors: 0
Mode: Concurrency
Concurrency: 1
- Name: runCommand
Action: 'ACS::ECS::RunCommand'
OnSuccess: DingTalkNotify
OnError: getExecutionFaildMessage
Description:
en: Verify the running status of the SAP HANA instance
zh-cn: 校驗SAP HANA實例運行狀態
Properties:
regionId: '{{ ACS::RegionId }}'
commandContent:
'Fn::Join':
- ''
- - 'su - '
- 'Fn::Jq':
- First
- .key | ascii_downcase
- key: '{{ HANASID }}'
- 'adm -c "sapcontrol -nr '
- '{{ HANAInstanceNumber }}'
- ' -function GetProcessList"; if [[ $? -eq 3 ]]; then exit 0;fi'
instanceId: '{{ checkForActivateClient.InstanceId }}'
commandType: RunShellScript
timeout: '180'
Outputs:
commandOutputs:
Type: String
ValueSelector: invocationOutput
- Name: getExecutionFaildMessage
Action: 'ACS::ExecuteAPI'
Description:
en: Get execution failure information
zh-cn: 獲取執行失敗信息
Properties:
Service: OOS
API: ListExecutions
Parameters:
ExecutionId: '{{ ACS::ExecutionId }}'
Outputs:
statusMessage:
Type: String
ValueSelector: 'Executions[].StatusMessage'
- Name: DingTalkNotifyExecutionFailed
Action: 'ACS::Notify'
OnSuccess: 'ACS::END'
Description:
en: Notification execution failure message
zh-cn: 通知執行失敗消息
Properties:
NotifyType: WebHook
WebHook:
URI: '{{ dingTalkWebhook }}'
Headers:
Content-Type: application/json
Content:
msgtype: markdown
markdown:
title: '{{ ACS::CurrentUTCTime }}-HBR自動測試執行失敗報告'
text:
'Fn::Join':
- |+
- - '#### {{ ACS::CurrentUTCTime }}-HBR自動測試執行失敗報告'
- '檢測數據庫:{{ databaseName }}'
- '錯誤信息:{{ getExecutionFaildMessage.statusMessage }}'
- '**詳情請到[OOS控制臺](https://oos.console.aliyun.com/{{ ACS::RegionId }}/execution/detail/{{ ACS::ExecutionId }})查看**'
at:
atMobiles: []
isAtAll: true
- Name: DingTalkNotify
Action: 'ACS::Notify'
Description:
en: Notify test results
zh-cn: 釘釘通知測試結果
Properties:
NotifyType: WebHook
WebHook:
URI: '{{ dingTalkWebhook }}'
Headers:
Content-Type: application/json
Content:
msgtype: markdown
markdown:
title: '{{ ACS::CurrentUTCTime }}-HBR自動測試報告'
text:
'Fn::Join':
- |+
- - '#### {{ ACS::CurrentUTCTime }}-HBR自動測試報告'
- 測試結果:SUCCESS
- '檢測數據庫:{{ databaseName }}'
- '目的實例:{{ ECSHostname }}'
- '目的實例Id:{{ checkForActivateClient.InstanceId }}'
- '**詳細信息請到[OOS控制臺](https://oos.console.aliyun.com/{{ACS::RegionId}}/execution/detail/{{ ACS::ExecutionId }})查看**'
at:
atMobiles: []
isAtAll: true
文檔內容是否對您有幫助?