调用RestoreDdrTable接口跨地域恢复数据到已有实例。
恢复前可以调用CheckCreateDdrDBInstance接口预检查某RDS实例是否可以用跨地域备份集进行跨地域恢复。
调用该接口时,实例必须满足以下条件,否则将操作失败:
- 源实例开启单库单表备份后创建新的跨地域备份。
- 如果需要按时间点恢复,源实例必须已开启跨地域日志备份。
- 恢复后的表名在目标实例中不存在。
- 仅适用于如下实例类型:
- RDS MySQL:支持的实例版本请参见MySQL跨地域备份。
- RDS SQL Server:支持的实例版本请参见SQL Server跨地域备份。
- RDS PostgreSQL :支持的实例版本请参见PostgreSQL跨地域备份。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
| 名称 | 类型 | 是否必选 | 示例值 | 描述 |
|---|---|---|---|---|
| Action | String | 是 | RestoreDdrTable |
系统规定参数。取值:RestoreDdrTable。 |
| DBInstanceId | String | 是 | rm-bpxxxxx |
要恢复的已有实例ID。 |
| RegionId | String | 否 | cn-hangzhou |
目标地域ID,可以通过接口DescribeRegions查看地域ID。 |
| ClientToken | String | 否 | ETnLKlblzczshOTUbOCzxxxxxxxxxx |
用于保证请求的幂等性,防止重复提交请求。由客户端生成该参数值,要保证在不同请求间唯一,最大值不超过64个ASCII字符,且该参数值中不能包含非ASCII字符。 |
| RestoreType | String | 是 | 0 |
恢复方式,取值:
默认值:0。 |
| BackupId | String | 否 | 279563 |
跨地域备份集ID。可以通过接口DescribeCrossRegionBackups查询。 说明 RestoreType=0时需要传入此参数。
|
| RestoreTime | String | 否 | 2020-04-25T16:00:00Z |
恢复时间点恢复的时间,需要早于当前时间。格式:yyyy-MM-ddTHH:mm:ssZ(UTC时间)。 说明 RestoreType=1时需要传入此参数。
|
| SourceRegion | String | 否 | cn-beijing |
基于时间点恢复的来源地域。 说明 RestoreType=1时需要传入此参数。
|
| SourceDBInstanceName | String | 否 | rm-bpxxxxx |
基于时间点恢复的来源实例ID。 说明 RestoreType=1时需要传入此参数。
|
| TableMeta | String | 是 | [{"type":"db","name":"testdb1","newname":"testdb1","tables":[{"type":"table","name":"test1","newname":"test1_backup"},{"type":"table","name":"test2","newname":"test2_backup"}]}] |
指定恢复的库表。格式:
|
| ResourceGroupId | String | 否 | rg-acfmy***** |
资源组ID。 |
返回数据
| 名称 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| RequestId | String | 75BBF1EF-1E90-4950-BFFB-252D26E8259B |
请求ID。 |
| DBInstanceId | String | rm-uf6wjk5***** |
实例ID。 |
示例
请求示例
http(s)://rds.aliyuncs.com/?Action=RestoreDdrTable
&DBInstanceId=rm-bpxxxxx
&RestoreType=0
&BackupId=279563
&TableMeta=[{"type":"db","name":"testdb1","newname":"testdb1","tables":[{"type":"table","name":"test1","newname":"test1_backup"},{"type":"table","name":"test2","newname":"test2_backup"}]}]
&<公共请求参数>
正常返回示例
XML格式
HTTP/1.1 200 OK
Content-Type:application/xml
<RestoreDdrTableResponse>
<RequestId>75BBF1EF-1E90-4950-BFFB-252D26E8259B</RequestId>
</RestoreDdrTableResponse>
JSON格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "75BBF1EF-1E90-4950-BFFB-252D26E8259B"
}
错误码
| HttpCode | 错误码 | 错误信息 | 描述 |
|---|---|---|---|
| 400 | InvalidRestoreType.Format | Specified restore type is not valid. | 指定的恢复类型无效。请设置合理的恢复类型。 |
| 400 | InvalidRestoreTime.Format | Specified restore time is not valid. | 操作失败,当前指定的恢复时间无效,请重新设置恢复时间。 |
| 400 | InvalidParamTableMeta | Invalid parameter TableMeta is null or not json format | 参数TableMeta不合法,请检查该参数的正确性。 |
| 400 | InvalidParamTableMeta.Content | TableMeta missing old dbname or new dbname, please check | 指定的table_meta参数缺少指定恢复的旧表和新表。 |
| 400 | InvalidParamTableMeta.Duplicate | TableMeta has duplicate db or table with other newname, commons or system | 操作失败,数据库中已存在指定恢复的库表。 |
| 400 | InvalidSourceRestoreDBName.NotFound | specific source restore dbname is not found in db list | 操作失败,备份集中不存在指定恢复的数据库。 |
| 400 | InvalidDBName.Duplicate | Specified DB name already exists in the This instance. | 当前实例中已存在相同的数据库名称。请更换名称。 |
| 400 | InvalidParameters.Format | Specified parameters is not valid. | 无效的参数。 |
| 400 | InvalidAvZone.Format | Specified AvZone is not valid. | 指定的AvZone不合法,请检查该参数的正确性。 |
| 400 | InvalidRegion.Format | Specified Region is not valid. | 指定的地域不合法,请检查该参数的正确性。 |
| 400 | InvalidVpcParameter | Specified VPCId VSwitchId or IPAddress or TunnelId is not valid. | VPCId VSwitchId不合法,请检查VPCId VSwitchId的正确性。 |
| 400 | MissingUserID | The request is missing a user_id parameter. | 用户ID不存在。 |
| 400 | MissingUID | The request is missing a uid parameter. | 操作失败,当前请求缺失UID。 |
| 403 | IncorrectDBInstanceType | Current DB instance type does not support this operation. | 操作失败,该实例状态下不支持此操作。 |
| 403 | IncorrectDBInstanceState | Current DB instance state does not support this operation. | 操作失败,该实例状态下不支持此操作。 |
| 403 | ChildDBInstanceExists | Current DB instance had child instance. | 操作失败,只读实例已存在。 |
| 403 | InvalidBackupLogStatus | Current backup log enable status does not support this operation. | 操作失败,日志备份未开启,无法按时间点恢复。 |
| 403 | IncorrectBackupSetMethod | Current backup set method does not support operations. | 操作失败,指定的备份集不支持库表恢复。 |
| 403 | IncorrectBackupSetState | Current backup set state does not support operations. | 操作失败,当前备份集状态不支持此操作。 |
| 404 | RestoreType.NotFound | RestoreType is not found. | 恢复方式(RestoreType)未找到。 |
| 404 | InvalidBackupSetID.NotFound | Specified backup set ID does not exist. | 备份集不存在。请查看已存在的备份集。 |
| 404 | InvalidBackup.NotFound | The available backup does not exist in recovery time. | 没有可用的备份集用于恢复数据。 |
| 404 | InvalidBinlog.NotFound | The available binlog does not exist in recovery time. | 指定恢复时间点的binlog无效。 |
| 404 | InvalidDB.NotFound | Specified db does not exist or DB status does not support. | 指定恢复的备份集中不存在指定的库表。 |
| 404 | InvalidDBInstance.NotFound | Specified instance does not exist or not support. | 指定的实例不存在指定的实例被删除或者实例不支持当前操作。 |
访问错误中心查看更多错误码。