You can call the RecoveryDBInstance operation to restore the databases of an instance.
You can call this operation to restore databases to a new instance or an existing instance. If you want to restore databases to an existing instance, we recommend that you call the Copy databases operation.
If you want to restore databases to a new instance, you must create an instance and then restore specific or all databases to the new instance.
- If you specify the name of a database, only the specified database is restored to the new instance.
- If you do not specify the name of a database, all databases are restored to the new instance.
Debugging
Request parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
| Action | String | Yes | RecoveryDBInstance | The operation that you want to perform. Set the value to RecoveryDBInstance. |
| DBInstanceClass | String | No | rds.mysql.s2.large | The instance type of the new instance. For more information, see Instance types. |
| DBInstanceStorage | Integer | No | 5 | The storage capacity of the new instance. Unit: GB. For more information, see Instance types. |
| PayType | String | No | Postpaid | The billing method of the new instance. Valid values:
|
| InstanceNetworkType | String | No | VPC | The network type of the new instance. Valid values:
By default, the new instance uses the same network type as the original instance. |
| DBInstanceId | String | No | rm-xxxxxxxx1 | The ID of the original instance. Note
|
| TargetDBInstanceId | String | No | rm-uf6wjk5xxxxxxx | The ID of the destination instance. |
| DbNames | String | Yes | Database restoration to a new instance: test1,test2; Database restoration to an existing instance: {"test1":"newtest1","test2":"newtest2"} | The name of the database.
|
| BackupId | String | No | 29304**** | The ID of the backup set. You can call the DescribeBackups operation to query the ID. If you specify this parameter, you do not need to specify the DBInstanceId parameter. Note You must specify at least one of the BackupId and RestoreTime parameters. |
| RestoreTime | String | No | 2011-06-11T16:00:00Z | The point in time to which you want to restore databases. You can select a point in time within the backup retention period. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC. If you specify this parameter, you must also specify the DBInstanceId parameter. Note You must specify at least one of the BackupId and RestoreTime parameters. |
| VPCId | String | No | vpc-xxxxxxxxxxx | The VPC ID of the new instance. |
| VSwitchId | String | No | vsw-xxxxxxxxxxx | The vSwitch ID of the new instance. If you specify more than one vSwitch ID, you must separate the IDs with commas (,). |
| PrivateIpAddress | String | No | 172.XXX.XXX.69 | The internal IP address of the new instance. The internal IP address must be within the CIDR block that is supported by the specified vSwitch. The system automatically assigns an internal IP address to the new instance based on the values of the VPCId and VSwitchId parameters. |
| UsedTime | String | No | 1 | The subscription duration of the instance. Valid values:
Note If you set the PayType parameter to Prepaid, you must also specify this parameter. |
| Period | String | No | Month | The unit that is used to calculate the billing cycle of the new instance. This parameter takes effect only when you select the subscription billing method for the new instance. Valid values:
Note If you set the PayType parameter to Prepaid, you must also specify this parameter. |
| DBInstanceStorageType | String | No | local_ssd | The storage type of the new instance. Valid values:
|
Response parameters
| Parameter | Type | Example | Description |
|---|---|---|---|
| DBInstanceId | String | rm-xxxxxxx | The ID of the instance. |
| RequestId | String | EFB6083A-7699-489B-8278-C0CB4793A96E | The ID of the request. |
| OrderId | String | 54325**** | The ID of the order. |
Examples
Sample requests
http(s)://rds.aliyuncs.com/?Action=RecoveryDBInstance
&DBInstanceClass=rds.mysql.s2.large
&DBInstanceStorage=5
&PayType=Postpaid
&InstanceNetworkType=VPC
&DBInstanceId=rm-xxxxxxxx1
&TargetDBInstanceId=rm-uf6wjk5xxxxxxx
&DbNames=Database restoration to a new instance: test1,test2; Database restoration to an existing instance: {"test1":"newtest1","test2":"newtest2"}
&BackupId=29304****
&RestoreTime=2011-06-11T16:00:00Z
&VPCId=vpc-xxxxxxxxxxx
&VSwitchId=vsw-xxxxxxxxxxx
&PrivateIpAddress=172.XXX.XXX.69
&UsedTime=1
&Period=Month
&DBInstanceStorageType=local_ssd
&Common request parameters
Sample success responses
XML format
HTTP/1.1 200 OK
Content-Type:application/xml
<RecoveryDBInstanceResponse>
<DBInstanceId>rm-xxxxxxx</DBInstanceId>
<RequestId>EFB6083A-7699-489B-8278-C0CB4793A96E</RequestId>
<OrderId>54325****</OrderId>
</RecoveryDBInstanceResponse>
JSON format
HTTP/1.1 200 OK
Content-Type:application/json
{
"DBInstanceId" : "rm-xxxxxxx",
"RequestId" : "EFB6083A-7699-489B-8278-C0CB4793A96E",
"OrderId" : "54325****"
}
Error codes
| HTTP status code | Error code | Error message | Description |
|---|---|---|---|
| 400 | IllegalParameter | illegal parameter, param is empty. | The error message returned because the specified parameters are invalid. |
| 400 | InvalidRecoveryDbInstance.StorageSize | The disk space of the new instance cannot be less than that of the current instance | The error message returned because the available storage of the new instance must be greater than or equal to the total size of data stored in the original instance. |
| 400 | DBCountLimitExceeded | Db count limit exceeded. | The error message returned because the number of databases exceeds the upper limit. |
| 403 | Forbidden.SnapshotRecovery | Snapshot backup does not support partial restore | The error message returned because the snapshot backup files cannot be used to restore only a specific part of data. |
For a list of error codes, see Service error codes.