All Products
Search
Document Center

Data Management:CreateDataArchiveOrder

Last Updated:Nov 28, 2024

Creates a data archiving ticket to archive data to destinations such as dedicated storage space or ApsaraDB RDS for MySQL instances.

Operation description

You can call this API operation only for database instances that are managed in Security Collaboration mode.

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
dms:CreateDataArchiveOrdercreate
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
CommentstringYes

The description of the task.

test
TidlongNo

The tenant ID. You can call the GetUserActiveTenant or ListUserTenants operation to obtain the tenant ID.

3***
PluginTypestringNo

The type of the plug-in. Default value: DATA_ARCHIVE.

DATA_ARCHIVE
RelatedUserListarrayNo

The list of the related users.

stringNo

The ID of an operator that is related to the ticket.

123***
ParentIdlongNo

The ID of the parent ticket. A parent ticket is generated only when a child ticket is created.

123****
ParamobjectYes

The parameters for archiving data.

ArchiveMethodstringYes

The archiving destination to which you want to archive data. Valid values:

Note If you set ArchiveMethod to a value other than inner_oss, you must register the corresponding destination database with Data Management (DMS) before you create the data archiving ticket. After the database is registered with DMS, the database is displayed in the Instances Connected section of the DMS console.
  • inner_oss: dedicated storage, which is a built-in Object Storage Service (OSS) bucket.
  • oss_userself: OSS bucket of the user.
  • mysql: ApsaraDB RDS for MySQL instance.
  • polardb: PolarDB for MySQL cluster.
  • adb_mysql: AnalyticDB for MySQL V3.0 cluster.
  • lindorm: Lindorm instance.
mysql
RunMethodstringYes

The method that is used to run the data archiving task. Valid values:

  • schedule: The data archiving task is periodically scheduled.
  • now: The data archiving task is immediately run.
now
VariablesarrayNo

The configuration of archiving variables. You can use a time variable as a filter condition for archiving data. Each variable has two attributes: name and pattern.

stringNo

The configuration of archiving variables.

{name: "time", pattern: "yyyy-MM-dd|+2d"}
LogicbooleanNo

Specifies whether the database is a logical database.

false
TableIncludesarray<object>Yes

The collection of tables to be archived.

objectYes
TableNamestringYes

The table name.

table1
TableWherestringNo

The filter condition that is specified by the WHERE clause of the archiving configuration. If a time variable is used in the filter condition, the filter condition is specified in the following format: field name <='${variable name}'. The variable name in the filter condition must be the same as the time variable name that is specified in the Variables parameter.

gmt_modified<'${time}'
TableMappingarrayNo

The table names mapped to the destination database. This parameter is not required and the default value is used.

stringNo

The table name mapped to the destination database.

table1
OrderAfterarrayNo

The post behaviors.

stringNo

The post behavior. Valid values:

  • delete: deletes the archived data from the source database.
  • check: verifies the archived data. This operation is time-consuming.
  • clear: deletes the temporary table. This value takes effect only when you select the other two values for this parameter at the same time.
"delete"
SourceCatalogNamestringYes

The catalog of the source database. Valid values:

  • def: Set this parameter to def if the source database is of the two-layer logical schema, such as a MySQL database, a PolarDB for MySQL cluster, or an AnalyticDB for MySQL instance.
  • Empty string: Set this parameter to an empty string if the source database is a Lindorm or ApsaraDB for MongoDB instance.
  • Catalog name: Set this parameter to the catalog name of the source database if the source database is of the three-layer logical schema, such as a PostgreSQL database.
def
SourceSchemaNamestringYes

The schema name of the source database. The schema name of the source database is the same as that of the destination database. If the source database is a MySQL database, this parameter specifies the name of the source database. If the source database is a PostgreSQL database, this parameter specifies the schema name of the source database.

schema_test
SourceInstanceNamestringYes

The name of the source instance. If the database instance is a self-managed database or a third-party cloud database, you can call the GetInstance operation to query the instance ID.

pc-bp1*******
TargetInstanceHoststringYes

The host of the destination instance. If the destination instance can be accessed over an internal network or the Internet, preferentially set the value to the internal endpoint of the destination instance.

  • If data is archived in an OSS bucket, set the value to the name of the bucket.
  • If data is archived in dedicated storage space, set the value to inner_oss.
am-bp1*********.ads.aliyuncs.com
CronStrstringNo

A crontab expression that specifies the scheduling cycle of the data archiving task. For more information, see the Crontab expressions section of the "Create shadow tables for synchronization" topic. You must specify this parameter if you set RunMethod to schedule.

00 05 11 * * ?
DatabaseIdstringNo

The database ID. If the database is a self-managed database or a third-party cloud database, you can call the GetDatabase operation to query the database ID. If the database is an Alibaba Cloud database, ignore this parameter.

1***

Response parameters

ParameterTypeDescriptionExample
object

The schema of the response.

RequestIdstring

The ID of the request, which is used to query logs and troubleshoot issues.

283C461F-11D8-48AA-B695-DF092DA32AF3
Successboolean

Indicates whether the request was successful. Valid values:

  • true
  • false
true
ErrorMessagestring

The error message returned if the request failed.

UnknownError
ErrorCodestring

The error code returned if the request failed.

UnknownError
CreateOrderResultarray

The ID of the data archiving ticket.

OrderIdslong

The data archiving ticket ID.

12*****

Examples

Sample success responses

JSONformat

{
  "RequestId": "283C461F-11D8-48AA-B695-DF092DA32AF3",
  "Success": true,
  "ErrorMessage": "UnknownError",
  "ErrorCode": "UnknownError",
  "CreateOrderResult": [
    0
  ]
}

Error codes

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

Change history

Change timeSummary of changesOperation
2024-05-13The internal configuration of the API is changed, but the call is not affectedView Change Details