暂停和恢复数据迁移 (Stretch Database)Pause and resume data migration (Stretch Database)

本主题适用于:yesSQL Server(仅从 2016 开始的 Windows)noAzure SQL 数据库noAzure SQL 数据仓库no并行数据仓库THIS TOPIC APPLIES TO: yesSQL Server (Windows only starting with 2016)noAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

若要暂停或恢复将数据迁移到 Azure,请为 SQL Server Management Studio 中的表选择“延伸” ,然后选择“暂停” 可以暂停数据迁移,或选择“恢复” 可以恢复数据迁移。To pause or resume data migration to Azure, select Stretch for a table in SQL Server Management Studio, and then select Pause to pause data migration or Resume to resume data migration. 你也可以使用 TRANSACT-SQL 来暂停或恢复数据迁移。You can also use Transact-SQL to pause or resume data migration.

若要排查本地服务器上的问题,或最大限度地扩大可用网络带宽,请暂停各个表上的数据迁移。Pause data migration on individual tables when you want to troubleshoot problems on the local server or to maximize the available network bandwidth.

暂停数据迁移Pause data migration

使用 SQL Server Management Studio 暂停数据迁移Use SQL Server Management Studio to pause data migration

  1. 在 SQL Server Management Studio 的对象资源管理器中,选择要对其暂停数据迁移的已启用延伸的表。In SQL Server Management Studio, in Object Explorer, select the Stretch-enabled table for which you want to pause data migration.

  2. 右键单击并选择“延伸”,然后选择“暂停”。Right-click and select Stretch, and then select Pause.

使用 TRANSACT-SQL 暂停数据迁移Use Transact-SQL to pause data migration

运行以下命令。Run the following command.

USE <Stretch-enabled database name>;
GO
ALTER TABLE <Stretch-enabled table name>  
    SET ( REMOTE_DATA_ARCHIVE ( MIGRATION_STATE = PAUSED ) ) ;  
GO 

恢复数据迁移Resume data migration

使用 SQL Server Management Studio 恢复数据迁移Use SQL Server Management Studio to resume data migration

  1. 在 SQL Server Management Studio 的对象资源管理器中,选择要对其恢复数据迁移的已启用延伸的表。In SQL Server Management Studio, in Object Explorer, select the Stretch-enabled table for which you want to resume data migration.

  2. 右键单击并选择“延伸”,然后选择“继续”。Right-click and select Stretch, and then select Resume.

使用 TRANSACT-SQL 恢复数据迁移Use Transact-SQL to resume data migration

运行以下命令。Run the following command.

USE <Stretch-enabled database name>;
GO
ALTER TABLE <Stretch-enabled table name>   
    SET ( REMOTE_DATA_ARCHIVE ( MIGRATION_STATE = OUTBOUND ) ) ;  
 GO

检查迁移处于活动状态还是暂停状态Check whether migration is active or paused

使用 SQL Server Management Studio 检查迁移处于活动状态还是暂停状态Use SQL Server Management Studio to check whether migration is active or paused

在 SQL Server Management Studio 中,打开“Stretch Database 监视器”并检查“迁移状态”列的值。In SQL Server Management Studio, open Stretch Database Monitor and check the value of the Migration State column. 有关详细信息,请参阅数据迁移的监视与故障排除For more info, see Monitor and troubleshoot data migration.

使用 Transact-SQL 检查迁移处于活动状态还是暂停状态Use Transact-SQL to check whether migration is active or paused

查询目录视图 sys.remote_data_archive_tables 并检查 is_migration_paused 列的值。Query the catalog view sys.remote_data_archive_tables and check the value of the is_migration_paused column. 有关详细信息,请参阅 sys.remote_data_archive_tablesFor more info, see sys.remote_data_archive_tables.

另请参阅See Also

ALTER TABLE (Transact-SQL)ALTER TABLE (Transact-SQL)
数据迁移的监视与故障排除Monitor and troubleshoot data migration