This topic describes the common solutions for migrating SQL Server databases to ApsaraDB RDS for SQL Server. 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 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 instance.
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.To use Data Transmission Service (DTS) for migration, make sure the following requirements are met:
The CIDR blocks of DTS servers are added to the source database and the destination instance. For more information, see Add the CIDR blocks of DTS servers.
The source database is supported by DTS. For more information, see Migrate data from a self-managed SQL Server database or an ApsaraDB RDS for SQL Server instance.
Cloud migration solutions
Physical migration solutions
Solution | Procedure | Reference |
Use Object Storage Service (OSS) to manually migrate data |
| |
Use Data Disaster Recovery and DTS to quickly migrate data |
|
Logical migration solutions
Solution | Procedure | Reference |
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 change data capture (CDC) instance polling and querying mode |
|
Other solutions
Solution | Procedure | Reference |
Use SSMS to migrate data |
|
Comparison of the cloud migration solutions
Physical migration solutions
Solution | Benefit | Limit |
Use OSS to manually migrate data |
|
|
Use Data Disaster Recovery and DTS to quickly migrate data |
|
|
Logical migration solutions
Solution | Benefit | Limit |
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 solutions
Solution | Benefit | Limit |
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 | Support for incremental migration | Supported solution | Recommended solution |
Self-managed SQL Server database | Yes |
| Use Data Disaster Recovery and DTS to migrate data to the cloud based on physical backup files |
Azure SQL Database | Yes |
| |
Azure SQL Managed Instance | |||
SQL Server on Azure Virtual Machines |
| ||
Amazon RDS for SQL Server | Yes |
| |
Huawei Cloud RDS for SQL Server | No |
| Use OSS to manually migrate full data to the cloud based on physical backup files Note
|
TencentDB for SQL Server database | Yes |
| |
No | Use SSMS to perform cloud migration | ||
Google Cloud SQL for SQL Server | Yes |
|
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.
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.