调用RestoreTable接口恢复RDS实例的某些数据库或表到原实例。
RDS MySQL支持单库和单表的数据恢复,可以通过备份指定恢复误删的数据库或表,快速恢复MySQL的数据。详情请参见单库单表备份。
调用该接口时,实例必须满足以下条件,否则将操作失败:
说明 仅适用于RDS MySQL实例。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | RestoreTable |
系统规定参数。取值:RestoreTable。 |
ClientToken | String | 否 | ETnLKlblzczshOTUbOCzxxxxxxxxxx |
用于保证请求的幂等性,防止重复提交请求。由客户端生成该参数值,要保证在不同请求间唯一,最大值不超过64个ASCII字符,且该参数值中不能包含非ASCII字符。 |
DBInstanceId | String | 是 | rm-uf6wjk5xxxxxxxxxx |
实例ID。 |
BackupId | String | 否 | 9026262 |
备份集ID。 您可以通过DescribeBackups接口获取备份集列表。 说明 BackupId和RestoreTime两者至少传入一个。
|
RestoreTime | String | 否 | 2011-06-11T16:00:00Z |
备份保留周期内的任意时间点。格式:yyyy-MM-ddTHH:mm:ssZ(UTC时间)。 说明
|
TableMeta | String | 是 | [{"type":"db","name":"testdb1","newname":"testdb1_new","tables":[{"type":"table","name":"testdb1table1","newname":"testdb1table1_new"}]}] |
指定恢复的库表。格式:
|
InstantRecovery | Boolean | 否 | true |
是否开启极速库表恢复。取值:
说明 关于极速库表恢复的更多信息,请参见恢复库表。
|
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
RequestId | String | EA2D4F34-01A7-46EB-A339-D80882135206 |
请求ID。 |
示例
请求示例
http(s)://rds.aliyuncs.com/?Action=RestoreTable
&DBInstanceId=rm-uf6wjk5xxxxxxxxxx
&RestoreTime=2019-08-20T16:00:00Z
&TableMeta=[{"type":"db","name":"dtstestdata","newname":"dtstestdata","tables":[{"type":"table","name":"customer_old","newname":"customer_old123"},{"type":"table","name":"order","newname":"order123"}]}]
&<公共请求参数>
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<RestoreTableResponse>
<RequestId>EA2D4F34-01A7-46EB-A339-D80882135206</RequestId>
</RestoreTableResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "EA2D4F34-01A7-46EB-A339-D80882135206"
}
错误码
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 | InvalidBakHistoryDO | BakHistory is inbalid when check restore 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。 |
400 | MissBackupSetAndRestoreTime.NotFound | Both BackupSet and RestoreTime are null. | 操作失败,BackupSet和RestoreTime都为空。 |
400 | InvalidBakHistory.DbVersionMismatch | db version of bakhistory is mismatch with custins | 库表恢复不允许备份数据的版本和原实例版本不同 |
403 | InvalidBackupLogStatus | Current backup log enable status does not support this operation. | 操作失败,日志备份未开启,无法按时间点恢复。 |
403 | IncorrectDBInstanceType | Current DB instance type does not support this operation. | 操作失败,该实例状态下不支持此操作。 |
403 | IncorrectDBInstanceState | Current DB instance state 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. | 操作失败,当前备份集状态不支持此操作。 |
403 | ChildDBInstanceExists | Current DB instance had child instance. | 操作失败,只读实例已存在。 |
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 | InvalidBackupSetID.NotFound | Specified backup set ID does not exist. | 备份集不存在。请查看已存在的备份集。 |
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. | 指定的实例不存在指定的实例被删除或者实例不支持当前操作。 |
访问错误中心查看更多错误码。