You can call the CreateMigrateTask operation to create a migration task to restore backup files from an Object Storage Service (OSS) bucket to an ApsaraDB RDS for SQL Server instance.

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 CreateMigrateTask

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

DBInstanceId String Yes rm-uf6wjk5xxxxxxx

The ID of the instance.

DBName String Yes testDB

The name of the database that you want to back up.

BackupMode String Yes FULL

The type of the migration task. Valid values:

  • FULL: The migration task migrates full backup files.
  • UPDF: The migration task migrates incremental or log backup files.
IsOnlineDB String Yes True

Specifies whether to make the restored database data available for user access. Valid values:

  • True
  • False
Note Set the value to True for instances that run SQL Server 2008 R2.
CheckDBMode String No AsyncExecuteDBCheck

The consistency check method for the database. Valid values:

  • SyncExecuteDBCheck: synchronous database check
  • AsyncExecuteDBCheck: asynchronous database check

Default value: AsyncExecuteDBCheck (compatible with SQL Server 2008 R2).

Note This parameter is valid when IsOnlineDB is set to True.
OssObjectPositions String No oss-ap-southeast-1.aliyuncs.com:rdsmssqlsingapore:autotest_2008R2_TestMigration_FULL.bak

The location of the backup file in the OSS bucket.

The value consists of the following parts that are separated by colons (:):

  • The OSS endpoint: oss-ap-southeast-1.aliyuncs.com.
  • The name of the OSS bucket: rdsmssqlsingapore.
  • The key of the backup file in the OSS bucket: autotest_2008R2_TestMigration_FULL.bak.
Note
  • This parameter is optional for instances that run SQL Server 2008 R2.
  • This parameter is required for instances that run a database engine later than SQL Server 2008 R2.
OSSUrls String No check_cdn_oss.sh www.xxxxxx.mobi

The shared URL of the backup file in the OSS bucket. The URL must be encoded.

If you specify multiple URLs, separate them with vertical bars (|) and then encode them.

Note This parameter is required for instances that run SQL Server 2008 R2.
MigrateTaskId String No None

The ID of the migration task. Valid values:

  • If BackupMode is set to FULL, the value of this parameter is empty. The full backup mode is compatible with instance that runs SQL Server 2008 R2.
  • If BackupMode is set to UPDF, the value of this parameter is the ID of the required full migration task.
Note
  • If IsOnlineDB is set to True, BackupMode must be set to FULL.
  • If IsOnlineDB is set to False, BackupMode must be set to UPDF.

Response parameters

Parameter Type Example Description
RequestId String 866F5EB8-4650-4061-87F0-379F6F968BCE

The ID of the request.

DBName String test02

The name of the database.

BackupMode String FULL

The type of the migration task. Valid values:

  • FULL: The migration task migrates full backup files.
  • UPDF: The migration task migrates incremental or log backup files.
DBInstanceId String rm-uf6wjk5xxxxx

The ID of the instance.

MigrateTaskId String 564563256

The ID of the migration task.

TaskId String 5451225

The ID of the task.

Examples

Sample requests

http(s)://rds.aliyuncs.com/?Action=CreateMigrateTask
&DBInstanceId=rm-uf6wjk5xxxxxxx
&DBName=testDB
&BackupMode=FULL
&IsOnlineDB=True
&OssObjectPositions=oss-ap-southeast-1.aliyuncs.com:rdsmssqlsingapore:autotest_2008R2_TestMigration_FULL.bak
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<?xml version="1.0" encoding="UTF-8" ?>
<CreateMigrateTaskResponse>
	<MigrateTaskId>135847</MigrateTaskId>
	<DBInstanceId>rm-bp178grbxxxxxxx</DBInstanceId>
	<RequestId>5F2B3757-BD56-40B3-B5F2-FCDD9FA0E2E2</RequestId>
	<BackupMode>UPDF</BackupMode>
	<TaskId>128301751</TaskId>
	<DBName>test02</DBName>
</CreateMigrateTaskResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "MigrateTaskId" : "135847",
  "DBInstanceId" : "rm-bp178grbxxxxxxx",
  "RequestId" : "5F2B3757-BD56-40B3-B5F2-FCDD9FA0E2E2",
  "BackupMode" : "UPDF",
  "TaskId" : "128301751",
  "DBName" : "test02"
}

Error codes

HTTP status code Error code Error message Description
400 InvalidFile The operation does not support this kind of file The error message returned because this operation is not supported for the current file type.
400 InvalidInstanceType The DB instance type does not support this operation. The error message returned because the operation is not supported by the current instance type.
400 InvalidInstanceLockMode The DB instance lock mode does not support this operation. The error message returned because this operation is not supported for a locked instance.
400 InvalidDBName The instance does not have the specified DB name. The error message returned because the specified destination database does not exist. Check the name and status of the destination database or specify another database.
400 InvalidDBType The DB type does not support this operation. The error message returned because the status of the database does not support this operation.
400 InvalidDBState The DB state does not support this operation. The error message returned because the status of the database does not support this operation.
400 ExceedUploadTime Exceeding the daily upload times of this DB. The error message returned because the number of downloads exceeds the daily upper limit of the database.
400 InvalidOSSURL The Specified OSS URL is not valid The error message returned because the specified OSS URL is invalid.
400 ExceedDiskSize The file size exceeding the disk size The error message returned because the file size exceeds the disk capacity. Check the file size and try again.
400 InvalideStatus Parent migrate task status is invalid. The error message returned because the status of the parent migration task is abnormal.
400 InvalidOssObjectStorageClassType The specified OSS bucket storage type is invalid. The error message returned because the storage class of the specified OSS bucket is invalid.
403 InvalidInstanceState The DB instance state does not support this operation. The error message returned because the status of the instance does not support this operation.

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