This topic describes how to migrate the data of some or all of the databases from an on-premises SQL Server instance to an ApsaraDB RDS for SQL Server instance. You can complete the data migration by using full backup files.
Prerequisites
- SQL Server 2017 EE on RDS Cluster Edition
- SQL Server 2008 R2, 2012 SE, 2012 EE, 2014 SE, 2016 SE, 2016 EE, 2017 SE, and 2019 SE on RDS High-availability Edition
- SQL Server 2012 SE, 2012 Web, and 2016 Web on RDS Basic Edition
Background information
ApsaraDB RDS for SQL Server supports the following three Object Storage Service (OSS)-based methods that are used to migrate the data of a single database from an on-premises instance to an RDS instance:
- Migrate full backup data to ApsaraDB RDS for SQL Server 2008 R2
- Migrate full backup data to ApsaraDB RDS for SQL Server 2012,2014, 2016, 2017, or 2019
- Migrate incremental backup data to ApsaraDB RDS for SQL Server 2012, 2014, 2016, 2017, or 2019
However, if a large number of databases are created on the on-premises instance, these methods are time-consuming.
To resolve the problem, ApsaraDB RDS for SQL Server also provides an OSS-based method that allows you to migrate the data of some or all of the databases from an on-premises instance to an RDS instance. You only need to upload the full backup files of these databases to the same folder in an OSS bucket, and then execute the script that is used to migrate data to an RDS instance.
Precautions
- Only full backup files can be used for the data migration.
- To migrate data by using a RAM user, you must grant the RAM user the AliyunOSSFullAccess and AliyunRDSFullAccess permissions. For more information, see Grant permissions to a RAM user.
Before you begin
Procedure
Common errors
Error | Cause | Solution |
---|---|---|
HTTP Status: 404 Error:InvalidAccessKeyId.NotFound Specified access key is not found.
RequestID: XXXXXXXXXXXXXXXXX |
The AccessKey ID used to call the API is incorrect. | Use the correct AccessKey ID and AccessKey secret. For more information, see FAQ about AccessKey pairs. |
HTTP Status: 400 Error:IncompleteSignature The request signature does not conform
to Aliyun standards. server string to sign is:...... |
The AccessKey secret used to call the API is incorrect. | |
RDS engine doesn't support, this is only for RDS SQL Server engine. |
The RDS instance does not run SQL Server. | Use an RDS instance that runs SQL Server as the RDS instance. |
Couldn't find specify RDS [XXX]. |
The ID of the RDS instance does not exist. | Check whether the ID of the RDS instance is correct. If the ID of the RDS instance is incorrect, enter the correct instance ID. |
{'status': -2, 'request-id': '', 'details': "RequestError: HTTPConnectionPool(host='xxxxxxxxxxxxxxxxx',
port=80): Max retries exceeded with url: /? bucketInfo= (Caused by NewConnectionError('<urllib3.connection.HTTPConnection
object at 0x10e996490>: Failed to establish a new connection: [Errno 8] nodename nor
servname provided, or not known',))"} |
The OSS endpoint is incorrect. | Check whether the entered OSS endpoint is correct. If the entered OSS endpoint is incorrect, enter the correct OSS endpoint. For more information, see Bucket overview. |
{'status': 404,'-id': 'xxxxxxxxx', 'details': {'HostId': 'xxxxxxxxx', 'Message': 'The
specified bucket does not exist.', 'Code': 'NoSuchBucket', 'RequestId': 'xxxxxxxx',
'BucketName': 'aaaatp-test-on-ecs'}} |
The OSS bucket does not exist. | Check whether the entered OSS bucket name is correct. If the entered OSS bucket name is incorrect, enter the correct OSS bucket name. |
There is no backup file on OSS Bucket [xxxxxx] under [xxxxxxxxx] folder, check please. |
The required folder does not exist in the OSS bucket, or the folder does not contain the backup files that meet the specified conditions. | Check whether the folder exists in the OSS bucket and whether the folder contains the backup files that meet the specified conditions. If the folder does not exist in the OSS bucket and the folder does not contain backup files that meet the conditions, create the folder in the OSS bucket and import backup files that meet the conditions. |
Warning!!!!!, [autotest_2005_ent_broken_full_dbcc_failed.bak] is not backup file,
filtered. |
The names of the backup files do not meet the naming conventions. | If you do not use the backup script to perform a backup, the names of the backup files
must follow the database name_backup type_backup time. bak format, for example, Testdb_FULL_20180518153544.bak .
|
HTTP Status: 403 Error:Forbidden.RAM The user is not authorized to operate the specified
resource, or this operation does not support RAM. RequestID: xxxxx{'status': 403,
'request-id': 'xxxx', 'details': {'HostId': 'atp-test-on-ecs.oss-cn-beijing.aliyuncs.com',
'Message': 'The bucket you visit is not belong to you.', 'Code': 'AccessDenied', 'RequestId':
'xxxx'}} |
The RAM user does not have the required permissions. | Grant the RAM user the AliyunOSSFullAccess and AliyunRDSFullAccess permissions. For more information about how to authorize the RAM user, see Authorize a RAM user. |
OPENAPI Response Error !!!!! : HTTP Status: <Http Status Code> Error:<Error> <Description>.
RequestID: 32BB6886-775E-4BB7-A054-635664**** |
An error occurs when the API is called. | Analyze the specific error cause based on the error information described in Table 2. |
HTTP status code | Error code | Error message | Description |
---|---|---|---|
403 | InvalidDBName | The specified database name is not allowed. | The error message returned because the specified database names are invalid. For example, the name of a database is invalid if it is the same as the name of a system database. |
403 | IncorrectDBInstanceState | Current DB instance state does not support this operation. | The error message returned because the RDS instance is not in a required state. For example, the RDS instance is in the Creating state. |
400 | IncorrectDBInstanceType | Current DB instance type does not support this operation. | The error message returned because the RDS instance does not run SQL Server. |
400 | IncorrectDBInstanceLockMode | Current DB instance lock mode does not support this operation. | The error message returned because the RDS instance is in a locking state that does not support the operation. |
400 | InvalidDBName.NotFound | Specified one or more DB name does not exist or DB status does not support. | The error message returned because the specified databases do not exist.
|
400 | IncorrectDBType | Current DB type does not support this operation. | The error message returned because the operation is not supported by the database engine of the RDS instance. |
400 | IncorrectDBState | Current DB state does not support this operation. | The error message returned because the databases are being created or receiving data from another migration task. |
400 | UploadLimitExceeded | UploadTimesQuotaExceeded: Exceeding the daily upload times of this DB. | The error message returned because the number of data uploads on the day exceeds 20 for a single database. |
400 | ConcurrentTaskExceeded | Concurrent task exceeding the allowed amount. | The error message returned because the number of data uploads on the day exceeds 500 for a single database. |
400 | IncorrectFileExtension | The file extension does not support. | The error message returned because the extensions of the backup file are invalid. |
400 | InvalidOssUrl | Specified oss url is not valid. | The error message returned because the specified OSS download URL is invalid. |
400 | BakFileSizeExceeded | Exceeding the allowed bak file size. | The error message returned because the size of the backup files exceeds 3 TB. |
400 | FileSizeExceeded | Exceeding the allowed file size of DB instance. | The error message returned because the size of the data restored from the backup files exceeds the available storage space of the RDS instance. |
Related operations
Operation | Description |
---|---|
CreateMigrateTask | Creates a migration task that is used to migrate backup files from an OSS bucket to an ApsaraDB for RDS instance. |
CreateOnlineDatabaseTask | Opens a database to which a migration task needs to migrate data on an ApsaraDB for RDS instance. |
DescribeMigrateTasks | Queries the migration tasks of an ApsaraDB for RDS instance. |
DescribeOssDownloads | Queries the backup files that a migration task needs to migrate to an ApsaraDB for RDS instance. |