You can call this operation to restore a database.

Database can be restored to an existing instance or restored to a new instance.

  • Restored to an existing instance: restore some databases in the old instance to the existing instance which can be the old instance or another instance in the same region. If the database name is repeated, you must use a new name. The old databases cannot be restored in overwrite mode.
  • Restored to a new instance: create a new instance, and then restore all or some databases in the old instance to the new instance.
    • If you specify a database name, the new instance only restores the corresponding database (partial restoration).
    • If you do not specify a database name, the new instance restores all the databases in the old instances.
Note This operation is applicable only to the instances of SQL Server 2012 and later versions.

Debugging

You can use API Explorer to perform debugging. API Explorer allows you to perform various operations to simplify API usage. For example, you can retrieve APIs, call APIs, and dynamically generate SDK example code.

Request parameters

Parameter Type Required? Example Description
Action String Yes RecoveryDBInstance

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

DbNames String Yes {sourceDbName1":"targetDbName1"}

The name of the database. If multiple databases are specified, the format is as follows: {"old database name 1":"new database name 1","old database name 2":"new database name 2"}

Note This parameter must be entered when databases are restored to existing instances.
TargetDBInstanceId String No rm-uf6wjk5xxxxxxx

The ID of the target instance.

DBInstanceClass String No rds.mysql.s2.large

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

DBInstanceStorage Integer No 5

The storage capacity of the new instance.

PayType String No Postpaid

The billing method of the new instance. Valid values:

  • Postpaid: Pay-As-You-Go.
  • Prepaid: subscription.
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 primary instance by default.

DBInstanceId String No rm-xxxxxxxx1

The ID of the old instance.

Note
  • When you restore databases by backup set by specifying the BackupId parameter, this parameter is not required.
  • When you restore databases by time point by specifying the RestoreTime parameter, this parameter is required.
BackupId String No 293044600

The ID of the backup set. You can call the DescribeBackups operation to obtain it.

When you specify this parameter, the DBInstanceIdparameter is optional.

Note Either BackupIdorRestoreTimeis required.
RestoreTime String No 2011-06-11T16:00:00Z

The point in time within the backup retention period. Format: yyyy-MM-ddTHH:mm:ssZ

When you specify this parameter, the DBInstanceIdparameter is required.

Note Either BackupIdor RestoreTimeis required.
VPCId String No vpc-xxxxxxxxxxx

The ID of the VPC.

VSwitchId String No vsw-xxxxxxxxxxx

The ID of the VSwitch. Separate multiple values with commas (,).

PrivateIpAddress String No vpc-xxxxxxxxxxx

The private IP address used to set the instance. It must be within the IP address range of the specified switch. The system automatically allocates the private IP addresses throughVPCIdandVSwitchIdby default.

Period String No Prepaid

The prepayment period of the instance. Valid values:

  • Year.
  • Month.
Note If the billing method isPrepaid, this parameter must be entered.
UsedTime String No Prepaid

The subscription period. Valid values:

  • WhenPeriodis set toYear, UsedTime can be1 to 3.
  • WhenPeriodis set toMonth, UsedTime can be1 to 9.
Note If the billing method is Prepaid, this parameter must be entered.

Response parameters

Parameter Type Example Description
DBInstanceId String rm-xxxxxxx

The name of the instance.

OrderId String 543254874

The ID of the order.

RequestId String EFB6083A-7699-489B-8278-C0CB4793A96E

The ID of the request.

Examples

Sample requests


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

Successful response examples

XML format

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

JSON format

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

Errors

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