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 backup set that is stored in a different region than the source instance.

Before you call this operation, make sure that the source instance runs one of the following database engine versions and RDS editions:

  • MySQL 8.0 on RDS High-availability Edition (with local SSDs)
  • MySQL 5.7 on RDS High-availability Edition (with local SSDs)
  • MySQL 5.6

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

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.

RestoreType String Yes 0

The method that you want to use for the restoration. Valid values:

  • 0: restores data from a backup set. You must also specify the BackupId parameter.
  • 1: restores data to a point in time. You must also specify the RestoreTime, SourceRegion, and SourceDBInstanceName parameters.

Default value: 0.

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 ensure that it is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length.

BackupId String No 279563

The ID of the cross-region backup set that you want to use. You can call the DescribeCrossRegionBackups operation to query the IDs of the backup sets that are available to an instance.

Note If you set the RestoreType parameter to0, 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 to1, 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 to1, 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 to1, you must also specify the SourceDBInstanceName parameter.
TableMeta String No [{"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. Format:

[{"type":"db","name":"<The name of Database 1 on the source instance>","newname":"<The name of Database 1 on the destination instance>","tables":[{"type":"table","name":"<The name of Table 1 in Database 1 on the source instance>","newname":"<The name of Table 1 in Database 1 on the destination instance>"},{"type":"table","name":"<The name of Table 2 in Database 1 on the source instance>","newname":"<The name of Table 2 in Database 1 on the destination instance>"}]},{"type":"db","name":"<The name of Database 2 on the source instance>","newname":"<The name of Database 2 on the destination instance>","tables":[{"type":"table","name":"<The name of Table 3 in Database 2 on the source instance>","newname":"<The name of Table 3 in Database 2 on the destination instance>"},{"type":"table","name":"<The name of Table 4 in Database 2 on the source instance>","newname":"<The name of Table 4 in Database 2 on the destination instance>"}]}]

Response parameters

Parameter Type Example Description
RequestId String 75BBF1EF-1E90-4950-BFFB-252D26E8259B

The ID of the request.

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

<RestoreDdrTableResponse>
  <RequestId>75BBF1EF-1E90-4950-BFFB-252D26E8259B</RequestId>
</RestoreDdrTableResponse>

JSON format

{
    "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 an invalid value is specified for the RestoreType parameter.
403 ChildDBInstanceExists Current DB instance had child instance. The error message returned because the source instance is attached with other instances.
400 InvalidRestoreTime.Format Specified restore time is not valid. The error message returned because an invalid value is specified for the RestoreTime parameter.
404 InvalidBackupSetID.NotFound Specified backup set ID does not exist. The error message returned because the backup set ID that is specified by the BackupId parameter cannot be found.
403 InvalidBackupLogStatus Current backup log enable status does not support this operation. The error message returned because the log backup feature is disabled and therefore the data of the source instance cannot be restored to a point in time.
404 InvalidBackup.NotFound The available backup does not exist in recovery time. The error message returned because no backup sets are available at the time of the restoration.
404 InvalidBinlog.NotFound The available binlog does not exist in recovery time. The error message returned because no valid log backup files at the specified point in time can be found.
403 IncorrectBackupSetMethod Current backup set method does not support operations. The error message returned because the specified backup set does not support the restoration of 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 backup set.
400 InvalidParamTableMeta Invalid parameter TableMeta is null or not json format The error message returned because an invalid value is specified 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 source and destination instances.
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 on the destination 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 backup set.
400 InvalidDBName.Duplicate Specified DB name already exists in the This instance. The error message returned because databases with the specified names already exist on the destination instance.
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 backup set.
400 InvalidParameters.Format Specified parameters is not valid. The error message returned because invalid values are specified for some parameters.
400 InvalidAvZone.Format Specified AvZone is not valid. The error message returned because an invalid value is specified for the avzone parameter.
400 InvalidRegion.Format Specified Region is not valid. The error message returned because an invalid value is specified for the region parameter.
400 InvalidVpcParameter Specified VPCId VSwitchId or IPAddress or TunnelId is not valid. The error message returned because invalid values are specified for the VPCId and VSwitchId parameters.
400 MissingUserID The request is missing a user_id parameter. The error message returned because the specified channel cannot be found.
400 MissingUID The request is missing a uid parameter. The error message returned because the specified account cannot be found.
404 InvalidDBInstance.NotFound Specified instance does not exist or not support. The error message returned because the specified instance cannot be found.

For a list of error codes, visit the API Error Center.