按备份集进行库表恢复
更新时间:2023-11-29
接口说明
按备份集点恢复指定库/表到原实例
请求结构
PUT /v{version}/instance/{instanceId}/recoveryToSourceInstanceBySnapshot
HOST: rds.bj.baidubce.com
Authorization:authorization string
{
"sourceInstanceId": "sourceInstanceId",
"targetInstanceId": "targetInstanceId",
"snapshotId": "snapshotId",
"data": [
{
"dbName": "dbName",
"newDbname": "newDbname",
"restoreMode": "restoreMode"
},
{
"dbname": "dbname",
"newDbname": "newDbname",
"restoreMode": "restoreMode",
"tables": [
{
"tableName": "tableName",
"newTablename": "newTablename"
}
]
}
]
}
请求头域
除公共头域外,无其它特殊头域。
请求参数
参数名称 | 参数类型 | 参数位置 | 是否必须 | 描述 | 示例值 |
---|---|---|---|---|---|
version | Integer | 是 | URL参数 | API版本号 | 1 |
instanceId | String | 是 | URL参数 | 实例ID | rds-qfsugnmr |
sourceInstanceId | String | 否 | requestbody参数 | 源实例ID,与URL参数instanceId一样,可以不写 | rds-qfsugnmr |
targetInstanceId | String | 否 | requestbody参数 | 恢复指定的实例ID,忽略此参数默认恢复到原实例 | rds-0C0fAMPT |
snapshotId | String | 是 | requestbody参数 | 备份 ID | 1689250390429085501 |
data | List<RecoveryTo SourceInstanceModel> |
是 | requestbody参数 | 要恢复的数据信息 | data":[{"dbName":"yangxue01","newDbname":"yangxue01_backup","restoreMode": "database" }] |
RecoveryToSourceInstanceModel字段数据结构说明
参数名称 | 参数类型 | 是否必须 | 参数位置 | 描述 | 示例值 |
---|---|---|---|---|---|
dbName | String | 是 | requestbody参数 | 需要恢复的库名称 | yangxue01 |
newDbname | String | 是 | requestbody参数 | 恢复后库名称。恢复至原实例时,dbName和newDbname不一样。恢复至指定实例时,dbName和newDbname可以一样 | yangxue01_backup |
restoreMode | String | 是 | requestbody参数 | 恢复模式,database(数据库),table(表)任选其一 | database |
tables | List<RecoveryToSource InstanceTableModel> |
否 | requestbody参数 | 表的对象集合,当restoreMode为table必填项,恢复目标实例 为database必项为非填项 | data":[{"dbName":"yangxue02","newDbname":"yangxue02","restoreMode": "table","tables": [ {"tableName": "table1","newTablename": "table1_backup"}] }] |
RecoveryToSourceInstanceTableModel字段数据结构说明
参数名称 | 参数类型 | 是否必须 | 参数位置 | 描述 | 示例值 |
---|---|---|---|---|---|
tableName | String | 是 | requestbody参数 | 需要恢复的表名 | table1 |
newTablename | String | 是 | requestbody参数 | 恢复后表名 | table1_backup |
返回头域
除公共头域外,无其它特殊头域。
返回参数
无
请求示例
PUT /v1/instance/rds-0C0fAMPT/recoveryToSourceInstanceBySnapshot
HOST: rds.bj.baidubce.com
Content-Type: application/json
Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2017-11-21T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
{
"sourceInstanceId": "rds-qfsugnmr",
"targetInstanceId": "rds-0C0fAMPT",
"snapshotId": "1689250390429085501",
"data": [{
"dbName": "yangxue01",
"newDbname": "yangxue01_backup",
"restoreMode": "database"
},
{
"dbname": "yangxue02",
"newDbname":"yangxue02",
"restoreMode":"table",
"tables": [ {
"tableName": "table1",
"newTablename": "table1_backup"
}]
}]
}
返回示例
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
x-bce-request-id: d8752367-38e8-45e4-b4c7-e53be3137ce5