You can call the RestoreDdrTable operation to restore the data of an ApsaraDB RDS instance to an existing instance across regions.
Before you call this operation, you can call the CheckCreateDdrDBInstance operation to check whether the data of the source instance can be restored from a cross-region backup file.
Before you call this operation, make sure that the following requirements are met:
- A cross-region backup file is created for the source instance after the restoration of individual databases or tables is enabled for the instance.
- If you want to restore data from a specific point in time, the log backup feature is enabled for the source instance.
- The names that you want to use for the restored tables do not exist in the destination instance.
- The source instance runs one of the following database engines:
- MySQL. For more information, see Back up an ApsaraDB RDS for MySQL instance across regions.
- SQL Server. For more information, see Back up an ApsaraDB RDS for SQL Server instance across regions.
- PostgreSQL. For more information, see Back up an ApsaraDB RDS for PostgreSQL instance across regions.
Debugging
Request parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
| Action | String | Yes | RestoreDdrTable |
The operation that you want to perform. Set the value to RestoreDdrTable. |
| DBInstanceId | String | Yes | rm-bpxxxxx |
The ID of the source instance. |
| RegionId | String | No | cn-hangzhou |
The region ID of the destination instance. You can call the DescribeRegions operation to query the most recent region list. |
| ClientToken | String | No | ETnLKlblzczshOTUbOCzxxxxxxxxxx |
The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must make sure that the generated token is unique among different requests. The token can only contain ASCII characters and cannot exceed 64 characters in length. |
| RestoreType | String | Yes | 0 |
The restoration method that you want to use. Valid values:
Default value: 0. |
| BackupId | String | No | 279563 |
The ID of the cross-region backup file that you want to use. You can call the DescribeCrossRegionBackups operation to query the ID of the cross-region backup file. Note If you set the RestoreType parameter to 0, you must also specify the BackupId parameter.
|
| RestoreTime | String | No | 2020-04-25T16:00:00Z |
The point in time to which you want to restore data. The specified point in time must be earlier than the current time. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC. Note If you set the RestoreType parameter to 1, you must also specify the RestoreTime parameter.
|
| SourceRegion | String | No | cn-beijing |
The region ID of the source instance whose data you want to restore to a point in time. Note If you set the RestoreType parameter to 1, you must also specify the SourceRegion parameter.
|
| SourceDBInstanceName | String | No | rm-bpxxxxx |
The ID of the source instance whose data you want to restore to a point in time. Note If you set the RestoreType parameter to 1, you must also specify the SourceDBInstanceName parameter.
|
| TableMeta | String | Yes | [{"type":"db","name":"testdb1","newname":"testdb1","tables":[{"type":"table","name":"test1","newname":"test1_backup"},{"type":"table","name":"test2","newname":"test2_backup"}]}] |
The names of the databases and tables that you want to restore for the source instance. Syntax:
|
| ResourceGroupId | String | No | rg-acfmy***** |
The ID of the resource group. |
Response parameters
| Parameter | Type | Example | Description |
|---|---|---|---|
| RequestId | String | 75BBF1EF-1E90-4950-BFFB-252D26E8259B |
The ID of the request. |
| DBInstanceId | String | rm-uf6wjk5***** |
The ID of the instance. |
Examples
Sample requests
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"}]}]
&<Common request parameters>
Sample success responses
XML format
HTTP/1.1 200 OK
Content-Type:application/xml
<RestoreDdrTableResponse>
<RequestId>75BBF1EF-1E90-4950-BFFB-252D26E8259B</RequestId>
</RestoreDdrTableResponse>
JSON format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "75BBF1EF-1E90-4950-BFFB-252D26E8259B"
}
Error codes
| HTTP status code | Error code | Error message | Description |
|---|---|---|---|
| 400 | InvalidRestoreType.Format | Specified restore type is not valid. | The error message returned because the specified restoration type is invalid. You must specify a valid restoration type. |
| 400 | InvalidRestoreTime.Format | Specified restore time is not valid. | The error message returned because the value of the RestoreTime parameter is invalid. You must specify a valid value for the RestoreTime parameter. |
| 400 | InvalidParamTableMeta | Invalid parameter TableMeta is null or not json format | The error message returned because the value of the TableMeta parameter is invalid. You must specify a valid value for the TableMeta parameter. |
| 400 | InvalidParamTableMeta.Content | TableMeta missing old dbname or new dbname, please check | The error message returned because the value of the TableMeta parameter does not specify the tables on the original and new databases. |
| 400 | InvalidParamTableMeta.Duplicate | TableMeta has duplicate db or table with other newname, commons or system | The error message returned because databases and tables with the specified names already exist in the new instance. |
| 400 | InvalidSourceRestoreDBName.NotFound | specific source restore dbname is not found in db list | The error message returned because the specified databases cannot be found in the specified data backup file. |
| 400 | InvalidDBName.Duplicate | Specified DB name already exists in the This instance. | The error message returned because the name of the specified database is duplicate in the instance. You must change the name of the specified database. |
| 400 | InvalidParameters.Format | Specified parameters is not valid. | The error message returned because a specified parameter is invalid. |
| 400 | InvalidAvZone.Format | Specified AvZone is not valid. | The error message returned because the value of the AvZone parameter is invalid. |
| 400 | InvalidRegion.Format | Specified Region is not valid. | The error message returned because the specified region is invalid. |
| 400 | InvalidVpcParameter | Specified VPCId VSwitchId or IPAddress or TunnelId is not valid. | The error message returned because the values of the VPCId and VSwitchId parameters are invalid. |
| 400 | MissingUserID | The request is missing a user_id parameter. | The error message returned because the specified user ID does not exist. |
| 400 | MissingUID | The request is missing a uid parameter. | The error message returned because the account that you use does not exist. |
| 403 | IncorrectDBInstanceType | Current DB instance type does not support this operation. | The error message returned because this operation is not supported when the instance is in the current state. |
| 403 | IncorrectDBInstanceState | Current DB instance state does not support this operation. | The error message returned because this operation is not supported when the instance is in the current state. |
| 403 | ChildDBInstanceExists | Current DB instance had child instance. | The error message returned because read-only instances are attached to the original instance. |
| 403 | InvalidBackupLogStatus | Current backup log enable status does not support this operation. | The error message returned because the log backup feature is disabled and consequently data cannot be restored to a specific point in time. |
| 403 | IncorrectBackupSetMethod | Current backup set method does not support operations. | The error message returned because the specified data backup file cannot be used to restore individual databases and tables. |
| 403 | IncorrectBackupSetState | Current backup set state does not support operations. | The error message returned because this operation is not supported due to the status of the specified data backup file. |
| 404 | RestoreType.NotFound | RestoreType is not found. | The error message returned because the specified restoration method does not exist. |
| 404 | InvalidBackupSetID.NotFound | Specified backup set ID does not exist. | The error message returned because the specified data backup file does not exist. You must specify a valid data backup file. |
| 404 | InvalidBackup.NotFound | The available backup does not exist in recovery time. | The error message returned because no data backup files are available. |
| 404 | InvalidBinlog.NotFound | The available binlog does not exist in recovery time. | The error message returned because no valid binary log files at the specified point in time are available. |
| 404 | InvalidDB.NotFound | Specified db does not exist or DB status does not support. | The error message returned because the specified databases and tables cannot be found in the specified data backup file. |
| 404 | InvalidDBInstance.NotFound | Specified instance does not exist or not support. | The error message returned because the instance cannot be found, is deleted, or does not support the operation. |
For a list of error codes, visit the API Error Center.