This topic introduces several common solutions for migrating SQL Server databases to the cloud. You can select the most suitable solution based on the data source location, tools used in each solution, and the benefits and limitations of each solution.
Preparations
Create a destination ApsaraDB RDS for SQL Server instance with specifications and storage space greater than or equal to those of the source database.
Execute the
SELECT name, compatibility_level FROM sys.databases;
statement on both the source and destination instances to check whether the destination instance is compatible with the source instance.Make sure that the security settings (including firewall rules, whitelists, and security groups) of the source and destination databases do not restrict the access of migration tools.
If you need to use Data Transmission Service (DTS) for cloud migration, ensure that:
You have added the CIDR blocks of DTS servers to the database whitelist settings so that DTS can access them normally.
The destination and source databases are within the migration scope supported by DTS.
Cloud migration solutions
Physical backup migration
Solution | Procedure | Tutorials |
Use OSS (manual migration) |
| |
Use Data Disaster Recovery and DTS (one-click migration) |
|
Logical data migration
Synchronization mode | Procedure | Tutorials |
Use DTS (log parsing mode) |
| |
Use DTS (hybrid log parsing mode) |
| |
Use DTS (CDC instance polling and querying mode) |
|
Other migration solutions
Solution | Procedure | Tutorials |
Use SSMS tool |
|
Comparison of cloud migration solutions
Physical backup migration
Solution | Benefits | Limitations |
Use OSS (manual migration) |
|
|
Use Data Disaster Recovery and DTS (one-click migration) |
|
|
Logical migration
Synchronization mode | Benefits | Limitations |
Use DTS (log parsing mode) |
|
|
Use DTS (hybrid log parsing mode) |
|
|
Use DTS (CDC instance polling and querying mode) |
|
|
Other migration solutions
Solution | Benefits | Limitations |
Use SSMS tool | Simple and stable operation process with low risk of data inconsistency. |
|
Cloud migration solution selection
If the data source does not support incremental migration, you need to stop writing data to the source database before performing cloud migration operations.
Data source | Whether incremental migration is supported | Available migration solutions | Recommended solution |
Self-managed SQL Server | Yes |
| Use Data Disaster Recovery and DTS physical backup for one-click migration |
Azure SQL Database | Yes |
| |
Azure SQL Managed Instance | |||
SQL Server on Azure Virtual Machines |
| ||
Amazon RDS for SQL Server | Yes |
| |
Huawei Cloud RDS SQL Server | No |
| Use OSS physical backup for manual full data migration Note
|
TencentDB for SQL Server | Yes |
| |
Google Cloud SQL for SQL Server | Yes |
|
What to do next
Data verification
After migrating SQL Server to the cloud, you typically need to verify whether all data has been fully migrated to the ApsaraDB RDS for SQL Server instance. You can perform verification based on your specific situation. Here are two common verification methods:
Core data verification
You can sort by date or auto-increment ID to verify whether the latest business data has been correctly migrated. For example, if the core business table Orders contains fields such as OrderID (auto-increment ID) and OrderDate (date), you can use the following statements for querying:
-- 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 using DTS
DTS supports verifying source and destination databases without service interruption. You can use DTS to create a full data verification task to verify whether all data has been fully migrated.
Update database statistics
If the performance of the destination ApsaraDB RDS for SQL Server instance significantly decreases after SQL Server migration, it may be because the data distribution in the ApsaraDB RDS for SQL Server instance has changed. You can perform a full update of statistics for specific databases to restore or improve instance performance.