Restores one or more databases of an ApsaraDB for RDS instance.

You can restore databases to an existing or new instance.

  • Restoration to an existing instance: The existing instance can be the original instance or any other instance located in the same region. If the name of a database already exists in the existing instance, you must specify a new name for that database.
  • Restoration to a new instance: Create an instance. Then, restore some or all databases of the original instance to the new instance.
    • If you specify database names, only databases with the specified names are restored to the new instance.
    • If you do not specify database names, all databases are restored to the new instance.
Note This operation is only supported for instances that run SQL Server 2012 and later.

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 RecoveryDBInstance

The operation that you want to perform. Set the value to RecoveryDBInstance.

DbNames String Yes {sourceDbName1":"targetDbName1"}

The name of the database you want to restore. If you specify more than one database, separate their names in the following format: {"Original Database Name 1":"New Database Name 1","Original Database Name 2":"New Database Name 2"}

Note This parameter must be specified when you restore databases to an existing instance.
DBInstanceClass String No rds.mysql.s2.large

The type of the new instance. For more information, see Primary instance types.

DBInstanceStorage Integer No 5

The storage capacity of the new instance. Unit: GB. For more information, see Primary instance types.

PayType String No Postpaid

The billing method of the new instance. Valid values:

  • Postpaid: specifies to use pay-as-you-go billing.
  • Prepaid: specifies to use subscription billing.
InstanceNetworkType String No VPC

The network type of the new instance. Valid values:

  • Classic
  • VPC

The new instance has the same network type as the original instance by default.

DBInstanceId String No rm-xxxxxxxx1

The ID of the original instance.

Note
  • You do not need to specify this parameter when you restore databases from the data backup file specified by the BackupId parameter.
  • This parameter must be specified when you restore databases to the point in time specified by the RestoreTime parameter.
TargetDBInstanceId String No rm-uf6wjk5xxxxxxx

The ID of the destination instance.

BackupId String No 293044600

The ID of the data backup file from which you want to restore databases. You can call the DescribeBackups operation to query the most recent data backup file list.

If you specify this parameter, you can choose not to specify the DBInstanceId parameter.

Note You must specify either the BackupId or RestoreTime parameter.
RestoreTime String No 2011-06-11T16:00:00Z

The point in time to which you want to restore databases. The point in time you specify must be within the log 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 either the BackupId or RestoreTime parameter.
VPCId String No vpc-xxxxxxxxxxx

The ID of the VPC to which the new instance belongs.

VSwitchId String No vsw-xxxxxxxxxxx

The ID of the VSwitch associated with the specified VPC. If you specify more than one VSwitch, separate their IDs with commas (,).

PrivateIpAddress String No 172.16.201.69

The private IP address of the new instance. The private IP address must be within the CIDR block supported by the specified VSwitch. The system automatically assigns a private IP address based on the VPCId and VSwitchId parameters.

UsedTime String No 1

The duration of the new instance if the new instance uses subscription billing. Valid values:

  • If you set the Period parameter to Year, the value of the UsedTime parameter ranges from 1 to 3.
  • If you set the Period parameter to Month, the value of the UsedTime parameter ranges from 1 to 9.
Note This parameter must be specified when the PayType parameter is set to Prepaid.
Period String No Month

The billing cycle of the new instance. Valid values:

  • Year
  • Month
Note This parameter must be specified when the PayType parameter is set to Prepaid.
DBInstanceStorageType String No local_ssd

The storage type of the new instance. Valid values:

  • local_ssd or ephemeral_ssd: specifies to use local SSDs.
  • cloud_ssd: specifies to use standard SSDs.
  • cloud_essd: specifies to use enhanced SSDs

Response parameters

Parameter Type Example Description
RequestId String EFB6083A-7699-489B-8278-C0CB4793A96E

The ID of the request.

DBInstanceId String rm-xxxxxxx

The ID of the instance.

OrderId String 543254874

The ID of the order.

Examples

Sample requests

http(s)://rds.aliyuncs.com/? Action=RecoveryDBInstance
&TargetDBInstanceId=rm-uf6wjk5xxxxxxx
&DbNames="sourceDbName":"targetDbName"
&BackupId=293044600
&<Common request parameters>

Sample success responses

XML format

<RecoveryDBInstanceResponse>
      <RequestId>EFB6083A-7699-489B-8278-C0CB4793A96E</RequestId>
</RecoveryDBInstanceResponse>

JSON format

{
    "RequestId": "EFB6083A-7699-489B-8278-C0CB4793A96E"
}

Error codes

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