调用RestoreTable接口恢复RDS实例的某些数据库或表到原实例。
RDS MySQL支持单库和单表的数据恢复,可以通过备份指定恢复误删的数据库或表,快速恢复MySQL的数据。详情请参见单库单表备份。
调用该接口时,实例必须满足以下条件,否则将操作失败:
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | RestoreTable |
系统规定参数,取值:RestoreTable。 |
DBInstanceId | String | 是 | rm-uf6wjk5xxxxxxxxxx |
实例ID。 |
TableMeta | String | 是 | [{"type":"db","name":"testdb1","newname":"testdb1_new","tables":[{"type":"table","name":"testdb1table1","newname":"testdb1table1_new"}]}] |
指定恢复的库表。格式:
|
ClientToken | String | 否 | ETnLKlblzczshOTUbOCzxxxxxxxxxx |
用于保证请求的幂等性,防止重复提交请求。由客户端生成该参数值,要保证在不同请求间唯一,最大值不超过64个ASCII字符,且该参数值中不能包含非ASCII字符。 |
BackupId | String | 否 | 9026262 |
备份集ID。 您可以通过DescribeBackups接口获取备份集列表。 说明 BackupId和RestoreTime两者至少传入一个。
|
RestoreTime | String | 否 | 2011-06-11T16:00:00Z |
备份保留周期内的任意时间点。格式:yyyy-MM-ddTHH:mm:ssZ(UTC时间)。 说明
|
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
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
格式
<RestoreTableResponse>
<RequestId>EA2D4F34-01A7-46EB-A339-D80882135206</RequestId>
</RestoreTableResponse>
JSON
格式
{
"RequestId": "EA2D4F34-01A7-46EB-A339-D80882135206"
}
错误码
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
403 | InvalidBackupLogStatus | Current backup log enable status does not support this operation. | 日志备份未开启,无法按时间点恢复 |
400 | InvalidRestoreType.Format | Specified restore type is not valid. | 指定的恢复类型无效。 |
400 | InvalidRestoreTime.Format | Specified restore time is not valid. | 指定的恢复时间无效。 |
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. | 指定的备份集 ID 不存在。 |
403 | IncorrectBackupSetMethod | Current backup set method does not support operations. | 指定的备份集不支持库表恢复 |
403 | IncorrectBackupSetState | Current backup set state does not support operations. | 当前备份集状态不支持此操作。 |
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. | 该实例已存在同名的数据库。 |
404 | InvalidDB.NotFound | Specified db does not exist or DB status does not support. | 指定恢复的备份集中不存在指定的库表 |
403 | ChildDBInstanceExists | Current DB instance had child instance. | 当前DB实例有子实例。 |
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. | 指定的region不合法 |
400 | InvalidVpcParameter | Specified VPCId VSwitchId or IPAddress or TunnelId is not valid. | 指定的VPCId VSwitchId不合法 |
400 | MissingUserID | The request is missing a user_id parameter. | 渠道不存在 |
400 | MissingUID | The request is missing a uid parameter. | 账号不存在 |
404 | InvalidDBInstance.NotFound | Specified instance does not exist or not support. | 指定的实例不存在 |
访问错误中心查看更多错误码。
在文档使用中是否遇到以下问题
更多建议
匿名提交