All Products
Search
Document Center

Database Backup:CreateDownload

Last Updated:Dec 10, 2024

Creates an advanced download task.

Operation description

Supported database engines

  • ApsaraDB RDS for MySQL
  • ApsaraDB RDS for PostgreSQL
  • PolarDB for MySQL

References

For the instances that meet your business requirements, you can create an advanced download task by point in time or backup set. You can set the download destination to a URL or directly upload the downloaded backup set to your Object Storage Service (OSS) bucket to facilitate data analysis and offline archiving.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
dbs:CreateDownloadcreate
*DBInstance
acs:rds:{#regionId}:{#accountId}:dbinstance/{#DbInstanceId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionCodestringYes

The ID of the region in which the instance resides. You can call the DescribeDBInstanceAttribute operation to query the region ID of the instance.

cn-beijing
InstanceNamestringYes

The ID of the instance.

rm-wz994c1t1****
BakSetTypestringNo

The type of the download task. Valid values:

  • full: downloads a full backup set.
  • pitr: downloads a backup set at a specific point in time.
full
BakSetIdstringNo

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

Note This parameter is required if the BakSetType parameter is set to full.
146005****
DownloadPointInTimestringNo

The point in time at which the backup set is downloaded. Specify a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

Note This parameter is required if the BakSetType parameter is set to pitr.
1661331864000
BakSetSizestringNo

The size of the full backup set. Unit: bytes. You can call the DescribeBackups operation to query the size of the full backup set.

216****
FormatTypestringNo

The format to which the downloaded backup set is converted. Valid values:

  • CSV
  • SQL
  • Parquet
Note This parameter is required.
CSV
TargetTypestringNo

The type of the destination to which the backup set is downloaded. Valid values:

  • OSS
  • URL
OSS
TargetBucketstringNo

The name of the OSS bucket that is used to store the backup set.

  • This parameter is required if the TargetType parameter is set to OSS.
  • Make sure that your account is granted the AliyunDBSDefaultRole permission. For more information, see Use RAM for resource authorization. You can also grant permissions based on the operation instructions in the Resource Access Management (RAM) console.
test123
TargetPathstringNo

The destination path to which the backup set is downloaded.

Note This parameter is required if the TargetType parameter is set to OSS.
test_db/path
TargetOssRegionstringNo

The region in which the OSS bucket resides.

Note This parameter is required if the TargetType parameter is set to OSS.
cn-beijing

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

RequestIdstring

The ID of the request.

A08F908D-2C35-583F-93C1-ED80753F****
ErrCodestring

The error code returned if the request failed.

DBS.ParamIsInValid
Successstring

Indicates whether the request was successful. Valid values:

  • true: The request was successful.
  • false: The request failed.
true
ErrMessagestring

The error message returned if the request failed.

formatType can not be empty
Codestring

The status code returned.

DBS.ParamIsInValid
Messagestring

The error message returned if the request failed.

formatType can not be empty
Dataobject

The information about the download task.

BakSetIdstring

The ID of the full backup set.

146005****
DownloadStatusstring

The state of the download task. Valid values:

  • initializing: The download task was being initialized.
  • queuing: The download task was queuing.
  • running: The download task was running.
  • failed: The download task failed.
  • finished: The download task was complete.
  • expired: The download task expired.
Note If the TargetType parameter is set to URL, the download task expires in three days after the task is complete.
initializing
Progressstring

The number of tables that have been downloaded and the total number of tables to be downloaded.

Note If the task is in the preparation stage, 0/0 is returned.
0/0
BackupSetTimelong

The point in time of the backup set if the task is used to download a backup set at a specific point in time. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

1661373070000
RegionCodestring

The ID of the region in which the instance resides.

cn-beijing
TargetPathstring

The destination path to which the backup set is downloaded.

Note This parameter is returned if the value of TargetType is OSS.
test_db/path
DbListstring

The database and table information that is returned if databases and tables are filtered by the download task.

testdb
ExportDataSizelong

The size of the downloaded data. Unit: bytes.

0
ImportDataSizelong

The size of the processed data. Unit: bytes.

0
GmtCreatelong

The time when the download task was created. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

1661940917570
TaskIdstring

The ID of the download task.

dt-qxnsfq5s****
Formatstring

The format to which the downloaded data is converted.

CSV
TargetTypestring

The type of the destination to which the backup set is downloaded.

URL

Examples

Sample success responses

JSONformat

{
  "RequestId": "A08F908D-2C35-583F-93C1-ED80753F****",
  "ErrCode": "DBS.ParamIsInValid",
  "Success": "true",
  "ErrMessage": "formatType can not be empty",
  "Code": "DBS.ParamIsInValid",
  "Message": "formatType can not be empty",
  "Data": {
    "BakSetId": "146005****",
    "DownloadStatus": "initializing",
    "Progress": "0/0",
    "BackupSetTime": 1661373070000,
    "RegionCode": "cn-beijing",
    "TargetPath": "test_db/path",
    "DbList": "testdb",
    "ExportDataSize": 0,
    "ImportDataSize": 0,
    "GmtCreate": 1661940917570,
    "TaskId": "dt-qxnsfq5s****",
    "Format": "CSV",
    "TargetType": "URL"
  }
}

Error codes

HTTP status codeError codeError message
403Request.ForbiddenHave no Permissions

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history