You can call the ImportUserBackupFile operation to import a specific full backup file of a self-managed MySQL database into an ApsaraDB RDS for MySQL instance.

Note A full backup file contains the data of a self-managed MySQL database. You can restore the data of a self-managed MySQL database from a full backup file to an ApsaraDB RDS for MySQL instance.

Before you call this operation, make sure that the following requirements are met:

Note This operation is supported only for MySQL 5.7.

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 ImportUserBackupFile

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

BackupFile String Yes {"Bucket":"test", "Object":"test/test_db_employees.xb","Location":"ap-southeast-1"}

A JSON array that consists of the information about the full backup file stored as an object in an OSS bucket. Example:

{"Bucket":"test", "Object":"test/test_db_employees.xb","Location":"ap-southeast-1"}

The following parameters are used in the array:

  • Bucket: The name of the OSS bucket in which the full backup file is stored as an object. You can call the GetBucket operation to query the information about all objects that are stored in an OSS bucket.
  • Object: The path of the full backup file that is stored as an object in an OSS bucket. You can call the GetObject operation to query the information about all paths in an OSS bucket.
  • Location: The ID of the region where the OSS bucket is located. You can call the GetBucketLocation operation to query the region of an OSS bucket.
BucketRegion String Yes cn-hangzhou

The region ID of the OSS bucket where the full backup file is located. You can call the DescribeRegions operation to query the most recent region list.

EngineVersion String Yes 5.7

The version of the database engine that is run on the self-managed MySQL database and ApsaraDB RDS for MySQL instance. Set the value to 5.7.

RegionId String Yes cn-hangzhou

The region ID of the ApsaraDB RDS for MySQL instance. You can call the DescribeRegions operation to query the most recent region list.

Note
  • The value of this parameter is the ID of the region where you want to create an ApsaraDB RDS for MySQL instance.
  • The value of this parameter must be consistent with the value of the BucketRegion parameter.
Comment String No BackupTest

The description of the full backup file.

RestoreSize Integer No 20

The size of storage space that is required to restore the data of the full backup file. Unit: GB.

Note
  • The default value of this parameter is 5 times the size of the full backup file.
  • The minimum value of this parameter is 20.
Retention Integer No 30

The retention period of the full backup file. Unit: days. Valid values: any non-zero positive integer.

ZoneId String No cn-hangzhou-b

The zone ID of the ApsaraDB RDS for MySQL instance. You can call the DescribeRegions operation to query the IDs of zones.

Note
  • If you specify this parameter, the system creates a snapshot in single-digit seconds, which greatly reduces the time that is required to import the full backup file.
  • When you call the CreateDBInstance operation to create an ApsaraDB RDS for MySQL instance by using the full backup file, the new ApsaraDB RDS for MySQL instance is created in the zone that you specify in this parameter.

Response parameters

Parameter Type Example Description
BackupId String b-n8tpg24c6i0v********

The ID of the full backup file.

RequestId String A140DD14-DCC9-4548-9C72-52A49A58A310

The ID of the request.

Status Boolean true

Indicates whether the full backup file is imported into the ApsaraDB RDS for MySQL instance. If the full backup file is imported, the true is returned. Otherwise, an error message is returned.

Examples

Sample requests

http(s)://rds.aliyuncs.com/?Action=ImportUserBackupFile
&BackupFile={"Bucket":"test", "Object":"test/test_db_employees.xb","Location":"ap-southeast-1"}
&BucketRegion=cn-hangzhou
&EngineVersion=5.7
&RegionId=cn-hangzhou
&<Common request parameters>

Sample success responses

XML format

<ImportUserBackupFileResponse>
      <RequestId>A140DD14-DCC9-4548-9C72-52A49A58A310</RequestId>
      <BackupId>b-n8tpg24c6i0v********</BackupId>
      <Status>true</Status>
</ImportUserBackupFileResponse>

JSON format

{
    "RequestId":"A140DD14-DCC9-4548-9C72-52A49A58A310",
    "BackupId":"b-n8tpg24c6i0v********",
    "Status":"true"
}

Error codes

HTTP status code Error code Error message Description
400 InvalidOssBackupFile.InvalidFile The specified OSS backup file is invalid. The error message returned because the specified full backup file cannot be found in the specified OSS bucket.
400 OperationDenied.Product The product code is not supported. The error message returned because the product code is not supported.

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