This topic describes the common solutions for migrating SQL Server databases to Alibaba Cloud. You can select a solution based on the location of the data source, the tools used in each solution, and the benefits and limits of each solution.
Preparations
The destination ApsaraDB RDS for SQL Server instance is created. The specifications and storage space of the destination instance are greater than or equal to those of the source database. For more information, see Create an ApsaraDB RDS for SQL Server instance.
NoteIf you want to use Data Transmission Service (DTS) to configure a data migration task, make sure that the source and destination database versions are supported by DTS. For more information, see Overview of data migration scenarios.
Execute the
SELECT name, compatibility_level FROM sys.databases;
statement on both the source and destination databases to check whether the destination database is compatible with the source database. For more information, see ALTER DATABASE (Transact-SQL) compatibility level.Make sure that the security settings, including firewall rules, whitelists, and security groups, of the source and destination databases do not restrict the access requests from data migration tools.
NoteIf you want to use DTS to configure a data migration task, make sure that DTS can access the source and destination databases. For more information, see Add the CIDR blocks of DTS servers.
Cloud migration solutions
Solution | Procedure | References | |
Cloud migration based on physical backup files | Use Object Storage Service (OSS) to manually migrate data |
| Migrate data from a self-managed SQL Server instance to an ApsaraDB RDS for SQL Server instance Note If the source database runs SQL Server 2008 R2, we recommend that you upgrade the database version before you perform the operation. |
Use Database Backup (DBS) and DTS to migrate data with a few clicks |
| ||
Logical cloud migration | Use DTS to migrate data in log parsing mode |
| Migrate data from a self-managed SQL Server database to an ApsaraDB RDS for SQL Server instance |
Use DTS to migrate data in hybrid log parsing mode |
| ||
Use DTS to migrate data in change data capture (CDC) instance polling and querying mode |
| ||
Other | Use SQL Server Management Studio (SSMS) to migrate data |
|
Comparison of the cloud migration solutions
Solution | Benefit | Limit | |
Cloud migration based on physical backup files | Use OSS to manually migrate data |
|
|
Use DBS and DTS to migrate data with a few clicks |
|
| |
Logical cloud migration | Use DTS to migrate data in log parsing mode |
|
|
Use DTS to migrate data in hybrid log parsing mode |
|
| |
Use DTS to migrate data in CDC instance polling and querying mode |
|
| |
Other | Use SSMS to migrate data | The operations are simple, the process is stable, and the risk of data inconsistency is low. |
|
Select a cloud migration solution
If the data source does not support incremental data migration, you must stop writing data to the source database before you migrate data to the cloud.
Data source | Whether incremental data migration is supported | Supported solution | Recommended solution |
Self-managed SQL Server database | Yes |
| Use DBS and DTS to migrate data to the cloud based on physical backup files with a few clicks. For more information, see Migrate data from a self-managed SQL Server database to an ApsaraDB RDS for SQL Server instance by using a physical gateway. |
Azure SQL Database | Yes |
| For more information about how to use the ApsaraDB RDS console to perform end-to-end cloud migration or how to use DTS to perform logical cloud migration, see Migrate data from a SQL Server database on Microsoft Azure to ApsaraDB RDS for SQL Server. |
Azure SQL Managed Instance | |||
SQL Server on Azure Virtual Machines |
| ||
Amazon RDS for SQL Server | Yes |
| For more information about how to use the ApsaraDB RDS console to perform end-to-end cloud migration or how to use DTS to perform logical cloud migration, see Migrate data from an Amazon RDS for SQL Server instance to an ApsaraDB RDS for SQL Server instance. |
Huawei Cloud RDS for SQL Server | No |
| For more information about how to use OSS to manually migrate full data to the cloud based on physical backup files, see Migrate the full backup data of a self-managed SQL Server instance to an ApsaraDB RDS instance that runs SQL Server 2008 R2 with cloud disks or runs SQL Server 2012 or later. Note
|
TencentDB for SQL Server database | Yes |
| For more information about how to use DTS to perform logical cloud migration, see Migrate data from a self-managed SQL Server database to an ApsaraDB RDS for SQL Server instance. |
No | Use SSMS to perform cloud migration | ||
Google Cloud SQL for SQL Server | Yes |
| For more information about how to use DTS to perform logical cloud migration, see Migrate data from a self-managed SQL Server database to an ApsaraDB RDS for SQL Server instance. |
What to do next
Data verification
After you migrate data from an SQL Server database to an ApsaraDB RDS for SQL Server instance, you can verify whether all data is migrated to the ApsaraDB RDS for SQL Server instance. You can use one of the following data verification methods based on your business requirements:
Core data verification
You can sort data by date or auto-increment ID to verify whether the latest business data is migrated. For example, if the core business table Orders contains fields such as OrderID and OrderDate, you can execute the following statement to query the fields in the source and destination databases:
-- SQL query in the source database
SELECT TOP 10 OrderID, OrderDate, CustomerID, TotalAmount
FROM Orders
ORDER BY OrderDate DESC;
-- SQL query in the destination database
SELECT TOP 10 OrderID, OrderDate, CustomerID, TotalAmount
FROM Orders
ORDER BY OrderDate DESC;
Full data verification by using DTS
DTS allows you to verify the data in the source and destination databases without service downtime. You can use DTS to create a full data verification task to check whether all data is migrated from the source database to the destination database. For more information, see Configure a data verification task.
Update database statistics
After you migrate data from an SQL Server database to an ApsaraDB RDS for SQL Server instance, the performance of the destination ApsaraDB RDS for SQL Server instance may decrease significantly due to changes to data distribution in the instance. You can update all statistics in specific databases to restore or improve the performance of the instance. For more information, see the Update database statistics section of the Manage the attributes of the database topic.