教學課程:使用 DMS 在線上將 MySQL 移轉至適用於 MySQL 的 Azure 資料庫Tutorial: Migrate MySQL to Azure Database for MySQL online using DMS

您可以使用 Azure 資料庫移轉服務,在最短的停止運作時間內將資料庫從內部部署 MySQL 執行個體移轉至適用於 MySQL 的 Azure 資料庫You can use Azure Database Migration Service to migrate the databases from an on-premises MySQL instance to Azure Database for MySQL with minimal downtime. 換句話說,移轉可在最短的應用程式停止運作時間內完成。In other words, migration can be achieved with minimum downtime to the application. 在本教學課程中,您會在 Azure 資料庫移轉服務中使用線上移轉活動,將 Employees 範例資料庫從內部部署的 MySQL 5.7 執行個體移轉至適用於 MySQL 的 Azure 資料庫。In this tutorial, you migrate the Employees sample database from an on-premises instance of MySQL 5.7 to Azure Database for MySQL by using an online migration activity in Azure Database Migration Service.

重要

在2021年6月1日,以平行處理、高效能的離線遷移案例取代「MySQL 至適用於 MySQL 的 Azure 資料庫」線上遷移案例。The “MySQL to Azure Database for MySQL” online migration scenario is being replaced with a parallelized, highly performant offline migration scenario on June 1, 2021. 針對線上遷移,您可以使用這項新供應專案搭配 資料輸入複寫。For online migrations, you can use this new offering together with data-in replication. 或者,使用開放原始碼工具(例如 MyDumper/MyLoader )搭配資料輸入複寫來進行線上遷移。Alternatively, use open-source tools such as MyDumper/MyLoader with data-in replication for online migrations.

在本教學課程中,您會了解如何:In this tutorial, you learn how to:

  • 使用 mysqldump 公用程式移轉範例結構描述。Migrate the sample schema using mysqldump utility.
  • 建立 Azure 資料庫移轉服務的執行個體。Create an instance of Azure Database Migration Service.
  • 使用 Azure 資料庫移轉服務來建立移轉專案。Create a migration project by using Azure Database Migration Service.
  • 執行移轉。Run the migration.
  • 監視移轉。Monitor the migration.

注意

若要使用「Azure 資料庫移轉服務」來執行線上移轉,必須根據「進階」定價層建立執行個體。Using Azure Database Migration Service to perform an online migration requires creating an instance based on the Premium pricing tier.

重要

為了獲得最佳的移轉體驗,Microsoft 建議在目標資料庫所在的同一個 Azure 區域中,建立 Azure 資料庫移轉服務的執行個體。For an optimal migration experience, Microsoft recommends creating an instance of Azure Database Migration Service in the same Azure region as the target database. 跨區域或地理位置移動資料可能使移轉程序變慢,並產生錯誤。Moving data across regions or geographies can slow down the migration process and introduce errors.

注意

無偏差通訊Bias-free communication

Microsoft 支援多元和包容性的環境。Microsoft supports a diverse and inclusionary environment. 本文包含 slave 單字的參考。This article contains references to the word slave. Microsoft 無偏差通訊的樣式指南會將這個單字辨識為排他性的單字。The Microsoft style guide for bias-free communication recognizes this as an exclusionary word. 本文中會使用這個單字來保持一致性,因為這個單字是目前出現在軟體中的單字。The word is used in this article for consistency because it's currently the word that appears in the software. 當軟體更新為移除此單字時,此文章將會更新以保持一致。When the software is updated to remove the word, this article will be updated to be in alignment.

PrerequisitesPrerequisites

若要完成本教學課程,您需要:To complete this tutorial, you need to:

  • 下載並安裝 MySQL 社群版 5.6 或 5.7。Download and install MySQL community edition 5.6 or 5.7. 內部部署 MySQL 版本必須符合「適用於 MySQL 的 Azure 資料庫」的版本。The on-premises MySQL version must match with Azure Database for MySQL version. 例如,MySQL 5.6 只能移轉至「適用於 MySQL 的 Azure 資料庫」5.6,而無法升級至 5.7。For example, MySQL 5.6 can only migrate to Azure Database for MySQL 5.6 and not upgraded to 5.7. 不支援與 MySQL 8.0 之間的移轉。Migrations to or from MySQL 8.0 are not supported.

  • 在適用於 MySQL 的 Azure 資料庫中建立執行個體Create an instance in Azure Database for MySQL. Refer to the article Use MySQL Workbench to connect and query data for details about how to connect and create a database using the Workbench application.Refer to the article Use MySQL Workbench to connect and query data for details about how to connect and create a database using the Workbench application.

  • 使用 Azure Resource Manager 部署模型建立 Azure 資料庫移轉服務的 Microsoft Azure 虛擬網路,以使用 ExpressRouteVPN 為您的內部部署來源伺服器提供站對站連線能力。Create a Microsoft Azure Virtual Network for Azure Database Migration Service by using Azure Resource Manager deployment model, which provides site-to-site connectivity to your on-premises source servers by using either ExpressRoute or VPN. 如需建立虛擬網路的詳細資訊,請參閱虛擬網路文件,特別是快速入門文章,裡面會提供逐步操作詳細資料。For more information about creating a virtual network, see the Virtual Network Documentation, and especially the quickstart articles with step-by-step details.

    注意

    在虛擬 networkNet 設定期間,如果您使用 ExpressRoute 搭配與 Microsoft 對等互連的網路,請將下列服務端點新增至將佈建服務的子網路:During virtual networkNet setup, if you use ExpressRoute with network peering to Microsoft, add the following service endpoints to the subnet in which the service will be provisioned:

    • 目標資料庫端點 (例如,SQL 端點、Cosmos DB 端點等)Target database endpoint (for example, SQL endpoint, Cosmos DB endpoint, and so on)
    • 儲存體端點Storage endpoint
    • 服務匯流排端點Service bus endpoint

    此為必要設定,因為 Azure 資料庫移轉服務沒有網際網路連線。This configuration is necessary because Azure Database Migration Service lacks internet connectivity.

  • 確定您的虛擬網路網路安全性群組規則不會封鎖 ServiceTag 的輸出埠443,以進行系統匯流排、儲存體和 AzureMonitor。Ensure that your virtual network Network Security Group rules don't block the outbound port 443 of ServiceTag for ServiceBus, Storage and AzureMonitor. 如需虛擬網路 NSG 流量篩選的詳細資訊,請參閱使用網路安全性群組來篩選網路流量For more detail on virtual network NSG traffic filtering, see the article Filter network traffic with network security groups.

  • 設定用於 Database Engine 存取的 Windows 防火牆Configure your Windows Firewall for database engine access.

  • 開啟您的 Windows 防火牆以允許 Azure 資料庫移轉服務存取來源 MySQL Server (依預設會使用 TCP 連接埠 3306)。Open your Windows firewall to allow Azure Database Migration Service to access the source MySQL Server, which by default is TCP port 3306.

  • 使用來源資料庫前面的防火牆應用裝置時,您可能必須新增防火牆規則,才能讓 Azure 資料庫移轉服務存取來源資料庫,以進行移轉。When using a firewall appliance in front of your source database(s), you may need to add firewall rules to allow Azure Database Migration Service to access the source database(s) for migration.

  • 為適用於 MySQL 的 Azure 資料庫建立伺服器層級的防火牆規則,以允許 Azure 資料庫移轉服務存取目標資料庫。Create a server-level firewall rule for Azure Database for MySQL to allow Azure Database Migration Service access to the target databases. 提供用於 Azure 資料庫移轉服務之虛擬網路的子網路範圍。Provide the subnet range of the virtual network used for Azure Database Migration Service.

  • 來源 MySQL 必須位於支援的 MySQL 社群版上。The source MySQL must be on supported MySQL community edition. 若要判斷 MySQL 公用程式或 MySQL Workbench 中的 MySQL 執行個體版本,請執行下列命令:To determine the version of MySQL instance, in the MySQL utility or MySQL Workbench, run the following command:

    SELECT @@version;
    
  • 適用於 MySQL 的 Azure 資料庫僅支援 InnoDB 資料表。Azure Database for MySQL supports only InnoDB tables. 若要將 MyISAM 資料表轉換為 InnoDB,請參閱將資料表從 MyISAM 轉換為 InnoDB 一文To convert MyISAM tables to InnoDB, see the article Converting Tables from MyISAM to InnoDB

  • 使用下列組態,在來源資料庫的 my.ini (Windows) 或 my.cnf (Unix) 檔案中啟用二進位記錄:Enable binary logging in the my.ini (Windows) or my.cnf (Unix) file in source database by using the following configuration:

    • server_id = 1 或更大 (僅與 MySQL 5.6 有關)server_id = 1 or greater (relevant only for MySQL 5.6)
    • log-bin =<path> (僅與 MySQL 5.6 相關) 例如:log-bin = E:\MySQL_logs\BinLoglog-bin =<path> (relevant only for MySQL 5.6) For example: log-bin = E:\MySQL_logs\BinLog
    • binlog_format = rowbinlog_format = row
    • Expire_logs_days = 5 (建議不要使用零;僅與 MySQL 5.6 有關)Expire_logs_days = 5 (it's recommended to not use zero; relevant only for MySQL 5.6)
    • Binlog_row_image = full (僅與 MySQL 5.6 有關)Binlog_row_image = full (relevant only for MySQL 5.6)
    • log_slave_updates = 1log_slave_updates = 1
  • 使用者必須有具備下列權限的 ReplicationAdmin 角色:The user must have the ReplicationAdmin role with the following privileges:

    • REPLICATION CLIENT - 只有變更處理工作需要此權限。REPLICATION CLIENT - Required for Change Processing tasks only. 換句話說,「僅限完整載入」工作並不需要此權限。In other words, Full Load only tasks don't require this privilege.
    • REPLICATION REPLICA - 只有變更處理工作需要此權限。REPLICATION REPLICA - Required for Change Processing tasks only. 換句話說,「僅限完整載入」工作並不需要此權限。In other words, Full Load only tasks don't require this privilege.
    • SUPER - 只有 MySQL 5.6.6 之前的版本需要此權限。SUPER - Only required in versions earlier than MySQL 5.6.6.

移轉範例結構描述Migrate the sample schema

若要完成所有資料表物件 (例如資料表結構描述、索引和預存程序),我們必須從來源資料庫擷取結構描述,並套用至資料庫。To complete all the database objects like table schemas, indexes and stored procedures, we need to extract schema from the source database and apply to the database. 若要擷取結構描述,您可以使用 mysqldump 搭配 --no-data 參數。To extract schema, you can use mysqldump with the --no-data parameter.

假設您在內部部署系統中有 MySQL 員工 範例資料庫,則使用 mysqldump 命令進行結構描述移轉的命令將是:Assuming you have MySQL Employees sample database in the on-premises system, the command to do schema migration using mysqldump is:

mysqldump -h [servername] -u [username] -p[password] --databases [db name] --no-data > [schema file path]

例如:For example:

mysqldump -h 10.10.123.123 -u root -p --databases employees --no-data > d:\employees.sql

若要將結構描述匯入至「適用於 MySQL 的 Azure 資料庫」目標,請執行下列命令:To import schema to Azure Database for MySQL target, run the following command:

mysql.exe -h [servername] -u [username] -p[password] [database]< [schema file path]

例如:For example:

mysql.exe -h shausample.mysql.database.azure.com -u dms@shausample -p employees < d:\employees.sql

如果您的結構描述中有外部索引鍵,則移轉的初始載入和持續同步將會失敗。If you have foreign keys in your schema, the initial load and continuous sync of the migration will fail. 請在 MySQL Workbench 中執行下列指令碼,以擷取 Drop 外部索引鍵指令碼和 Add 外部索引鍵指令碼。Execute the following script in MySQL Workbench to extract the drop foreign key script and add foreign key script.

SET group_concat_max_len = 8192;
    SELECT SchemaName, GROUP_CONCAT(DropQuery SEPARATOR ';\n') as DropQuery, GROUP_CONCAT(AddQuery SEPARATOR ';\n') as AddQuery
    FROM
    (SELECT
    KCU.REFERENCED_TABLE_SCHEMA as SchemaName,
    KCU.TABLE_NAME,
    KCU.COLUMN_NAME,
    CONCAT('ALTER TABLE ', KCU.TABLE_NAME, ' DROP FOREIGN KEY ', KCU.CONSTRAINT_NAME) AS DropQuery,
    CONCAT('ALTER TABLE ', KCU.TABLE_NAME, ' ADD CONSTRAINT ', KCU.CONSTRAINT_NAME, ' FOREIGN KEY (`', KCU.COLUMN_NAME, '`) REFERENCES `', KCU.REFERENCED_TABLE_NAME, '` (`', KCU.REFERENCED_COLUMN_NAME, '`) ON UPDATE ',RC.UPDATE_RULE, ' ON DELETE ',RC.DELETE_RULE) AS AddQuery
    FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU, information_schema.REFERENTIAL_CONSTRAINTS RC
    WHERE
      KCU.CONSTRAINT_NAME = RC.CONSTRAINT_NAME
      AND KCU.REFERENCED_TABLE_SCHEMA = RC.UNIQUE_CONSTRAINT_SCHEMA
  AND KCU.REFERENCED_TABLE_SCHEMA = 'SchemaName') Queries
  GROUP BY SchemaName;

執行查詢結果中的 Drop 外部索引鍵 (這是第二個資料行),以卸除外部索引鍵。Run the drop foreign key (which is the second column) in the query result to drop foreign key.

注意

Azure DMS 不支援 CASCADE 參考動作,這有助於在父資料表中刪除或更新資料列時,自動刪除或更新子資料表中相符的資料列。Azure DMS does not support the CASCADE referential action, which helps to automatically delete or update a matching row in the child table when a row is deleted or updated in the parent table. 如需詳細資訊,請參閱 MySQL 文件中外部索引鍵條件約束一文的「參考動作」一節。For more information, in the MySQL documentation, see the Referential Actions section of the article FOREIGN KEY Constraints. Azure DMS 會要求您在初始資料載入期間,將外部索引鍵條件約束放在目標資料庫伺服器中,而且您不能使用參考動作。Azure DMS requires that you drop foreign key constraints in the target database server during the initial data load, and you cannot use referential actions. 如果您的工作負載相依於透過此參考動作來更新相關的子資料表,我們建議您改為執行傾印並還原If your workload depends on updating a related child table via this referential action, we recommend that you perform a dump and restore instead.

重要

如果使用備份匯入資料,執行 mysqldump 時以手動方式或使用 --skip-definer 命令移除 CREATE DEFINER 命令。If importing data using a backup, remove the CREATE DEFINER commands manually or by using the --skip-definer command when performing a mysqldump. DEFINER 需要進階的權限才能建立,且在適用於 MySQL 的 Azure 資料庫中會受到限制。DEFINER requires super privileges to create and is restricted in Azure Database for MySQL.

如果您在資料庫中有觸發程式,則會在從來源進行完整資料移轉之前,在目標中強制執行資料完整性。If you have triggers in the database, it will enforce data integrity in the target ahead of full data migration from the source. 建議您在遷移期間停用目標中所有資料表上的觸發程式,然後在遷移完成後啟用觸發程式。The recommendation is to disable triggers on all the tables in the target during migration, and then enable the triggers after migration is done.

在目標資料庫上的 MySQL 工作臺中執行下列腳本,以解壓縮 drop trigger 腳本和 add trigger 腳本。Execute the following script in MySQL Workbench on the target database to extract the drop trigger script and add trigger script.

SELECT
    SchemaName,
    GROUP_CONCAT(DropQuery SEPARATOR ';\n') as DropQuery,
    Concat('DELIMITER $$ \n\n', GROUP_CONCAT(AddQuery SEPARATOR '$$\n'), '$$\n\nDELIMITER ;') as AddQuery
FROM
(
SELECT 
    TRIGGER_SCHEMA as SchemaName,
    Concat('DROP TRIGGER `', TRIGGER_NAME, "`") as DropQuery,
    Concat('CREATE TRIGGER `', TRIGGER_NAME, '` ', ACTION_TIMING, ' ', EVENT_MANIPULATION, 
            '\nON `', EVENT_OBJECT_TABLE, '`\n' , 'FOR EACH ', ACTION_ORIENTATION, ' ',
            ACTION_STATEMENT) as AddQuery
FROM  
    INFORMATION_SCHEMA.TRIGGERS
ORDER BY EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE, ACTION_TIMING, EVENT_MANIPULATION, ACTION_ORDER ASC
) AS Queries
GROUP BY SchemaName

在結果中,執行產生的 drop trigger 查詢 (DropQuery 資料行) ,以卸載目標資料庫中的觸發程式。Run the generated drop trigger query (DropQuery column) in the result to drop triggers in the target database. 您可以儲存新增觸發程式查詢,以在資料移轉完成之後使用。The add trigger query can be saved, to be used post data migration completion.

註冊 Microsoft.DataMigration 資源提供者Register the Microsoft.DataMigration resource provider

  1. 登入 Azure 入口網站,選取 [所有服務],然後選取 [訂用帳戶]。Sign in to the Azure portal, select All services, and then select Subscriptions.

    顯示入口網站訂用帳戶

  2. 選取您要在其中建立 Azure 資料庫移轉服務執行個體的訂用帳戶,然後選取 [資源提供者]。Select the subscription in which you want to create the instance of Azure Database Migration Service, and then select Resource providers.

    顯示資源提供者

  3. 搜尋移轉,然後在 [Microsoft.DataMigration] 的右邊,選取 [註冊]。Search for migration, and then to the right of Microsoft.DataMigration, select Register.

    註冊資源提供者

建立資料庫移轉服務實例Create a Database Migration Service instance

  1. 在 Azure 入口網站中,選取 [+ 建立資源],搜尋「Azure 資料庫移轉服務」,然後從下拉式清單選取 [Azure 資料庫移轉服務]。In the Azure portal, select + Create a resource, search for Azure Database Migration Service, and then select Azure Database Migration Service from the drop-down list.

    Azure Marketplace

  2. 在 [Azure 資料庫移轉服務] 畫面上,選取 [建立]。On the Azure Database Migration Service screen, select Create.

    建立 Azure 資料庫移轉服務執行個體

  3. 在 [建立移轉服務] 畫面上,指定服務的名稱、訂用帳戶,以及新的或現有的資源群組。On the Create Migration Service screen, specify a name for the service, the subscription, and a new or existing resource group.

  4. 選取定價層,然後移至 [網路] 畫面。Select a pricing tier and move to the networking screen. 標準和 Premium 定價層都有提供離線遷移功能。Offline migration capability is available in both Standard and Premium pricing tier.

    如需成本和定價層的詳細資訊,請參閱定價分頁For more information on costs and pricing tiers, see the pricing page.

    設定 Azure 資料庫移轉服務基本設定

  5. 從清單中選取現有的虛擬網路,或提供要建立的新虛擬網路名稱。Select an existing virtual network from the list or provide the name of new virtual network to be created. 移至 [審核 + 建立] 畫面。Move to the review + create screen. (選擇性)您可以使用 [標記] 畫面,將標記新增至服務。Optionally you can add tags to the service using the tags screen.

    虛擬網路會為 Azure 資料庫移轉服務提供來源 SQL Server 和目標 Azure SQL Database 執行個體的存取權。The virtual network provides Azure Database Migration Service with access to the source SQL Server and the target Azure SQL Database instance.

    設定 Azure 資料庫移轉服務網路設定

    如需如何在 Azure 入口網站中建立虛擬網路的詳細資訊,請參閱使用 Azure 入口網站建立虛擬網路一文。For more information about how to create a virtual network in the Azure portal, see the article Create a virtual network using the Azure portal.

  6. 檢查設定,然後選取 [ 建立 ] 以建立服務。Review the configurations and select Create to create the service.

    Azure 資料庫移轉服務建立

建立移轉專案Create a migration project

建立服務之後,請在 Azure 入口網站中找出該服務,然後建立新的移轉專案。After the service is created, locate it within the Azure portal, open it, and then create a new migration project.

  1. 在 Azure 入口網站中,選取 [所有服務],搜尋 Azure 資料庫移轉服務,然後選取 [Azure 資料庫移轉服務]。In the Azure portal, select All services, search for Azure Database Migration Service, and then select Azure Database Migration Services.

    找出 Azure 資料庫移轉服務的所有執行個體

  2. 從搜尋結果中選取您的遷移服務實例,然後選取 [+ 新增遷移專案]。Select your migration service instance from the search results and select + New Migration Project.

    建立新的移轉專案

  3. 在 [ 新增遷移專案 ] 畫面上,指定專案的名稱,在 [ 來源伺服器類型 選擇] 方塊中,選取 [ Mysql],在 [ 目標伺服器類型 選擇] 方塊中,選取 [ 適用于 Mysql 的 Azure 資料庫 ],然後在 [ 遷移活動類型 選擇] 方塊中,選取 [ 線上資料移轉]。On the New migration project screen, specify a name for the project, in the Source server type selection box, select MySQL, in the Target server type selection box, select Azure Database For MySQL and in the Migration activity type selection box, select Online data migration. 選取 [建立及執行活動]。Select Create and run activity.

    建立資料庫移轉服務專案

    注意

    或者,您可以選擇 [僅建立專案] 以立即建立移轉專案,並於後續再執行移轉。Alternately, you can choose Create project only to create the migration project now and execute the migration later.

設定遷移專案Configure migration project

  1. 在 [ 選取來源 ] 畫面上,指定來源 MySQL 實例的連線詳細資料,然後選取 [下一步:選取目標>>On the Select source screen, specify the connection details for the source MySQL instance, and select Next : Select target>>

    新增來源詳細資料畫面

  2. 在 [ 選取目標 ] 畫面上,指定目標適用於 MySQL 的 Azure 資料庫實例的連接詳細資料,然後選取 [下一步:選取資料庫]>>On the Select target screen, specify the connection details for the target Azure Database for MySQL instance, and select Next : Select databases>>

    新增目標詳細資料畫面

  3. 在 [ 選取資料庫 ] 畫面上,對應來源和目標資料庫以進行遷移,然後選取 [下一步:設定遷移設定>>On the Select databases screen, map the source and the target database for migration, and select Next : Configure migration settings>>. 您可以選取 [ 設為來源伺服器唯讀 ] 選項,將來源設為唯讀,但請注意,這是伺服器層級設定。You can select the Make Source Server Readonly option to make the source as read-only, but be cautious that this is a server level setting. 如果選取此選項,則會將整個伺服器設定為唯讀,而不只是選取的資料庫。If selected, it sets the entire server to read-only, not just the selected databases.

    如果目標資料庫包含與來源資料庫相同的資料庫名稱,Azure 資料庫移轉服務依預設會選取目標資料庫。If the target database contains the same database name as the source database, Azure Database Migration Service selects the target database by default. 選取資料庫詳細資料畫面Select database details screen

    注意

    雖然您可以在此步驟中選取多個資料庫,但是 Azure 資料庫移轉服務的每個執行個體最多可支援 4 個資料庫進行並行移轉。Though you can select multiple databases in this step, each instance of Azure Database Migration Service supports up to 4 databases for concurrent migration. 此外,每個區域的每個訂用帳戶限制只能有 10 個 Azure 資料庫移轉服務執行個體。Also, there is a limit of 10 instances of Azure Database Migration Service per subscription per region. 例如,如果您有 80 個要遷移的資料庫,則可以同時將其中的 40 個遷移到相同的區域,但前提是您已經建立 10 個 Azure 資料庫移轉服務執行個體。For example, if you have 80 databases to migrate, you can migrate 40 of them to the same region concurrently, but only if you have created 10 instances of the Azure Database Migration Service.

  4. 在 [ 設定遷移設定 ] 畫面上,選取要作為遷移一部分的資料表,然後選取 [下一步:摘要>>]On the Configure migration settings screen, select the tables to be part of migration, and select Next : Summary>>. 如果目標資料表有任何資料,則預設不會選取它們,但您可以明確地選取它們,然後在開始遷移之前將它們截斷。If the target tables have any data, they are not selected by default but you can explicitly select them and they will be truncated before starting the migration.

    選取資料表畫面

  5. 在 [ 摘要 ] 畫面的 [ 活動名稱 ] 文字方塊中,指定遷移活動的名稱並查看摘要,以確定來源和目標詳細資料符合您先前指定的內容。On the Summary screen, in the Activity name text box, specify a name for the migration activity and review the summary to ensure that the source and target details match what you previously specified.

    移轉專案摘要

  6. 選取 [開始移轉]。Select Start migration. [移轉活動] 視窗隨即出現,且活動的 [狀態] 為 [正在初始化]。The migration activity window appears, and the Status of the activity is Initializing. 當資料表遷移開始時, 狀態 會變更為 [ 正在 執行]。The Status changes to Running when the table migrations start.

監視移轉Monitor the migration

  1. 在移轉活動畫面上,選取 [重新整理] 以更新顯示,直到移轉的 [狀態] 顯示為 [完成] 為止。On the migration activity screen, select Refresh to update the display until the Status of the migration shows as Complete.

    活動狀態 - 完成

  2. 在 [資料庫名稱] 下方選取特定資料庫,以顯示 [載入完整資料] 和 [累加式資料同步] 作業的移轉狀態。Under Database Name, select specific database to get to the migration status for Full data load and Incremental data sync operations.

    完整資料載入會顯示初始載入移轉狀態,而累加式資料同步會顯示異動資料擷取 (CDC) 狀態。Full data load will show the initial load migration status while Incremental data sync will show change data capture (CDC) status.

    活動狀態 - 完整載入已完成

    活動狀態 - 累加式資料同步

執行完全移轉Perform migration cutover

初始完整載入完成後,資料庫會標示為 [已可執行完全移轉]。After the initial Full load is completed, the databases are marked Ready to cutover.

  1. 當您準備好要完成資料庫移轉後,請選取 [開始完全移轉]。When you're ready to complete the database migration, select Start Cutover.

    開始完全移轉

  2. 確實停止所有傳入來源資料庫的交易;等到 [暫止的變更] 計數器顯示為 0 為止。Make sure to stop all the incoming transactions to the source database; wait until the Pending changes counter shows 0.

  3. 選取 [確認],然後選取 [套用]。Select Confirm, and the select Apply.

  4. 當資料庫移轉狀態顯示為 [已完成] 後,請將應用程式連線至新的目標 Azure SQL Database。When the database migration status shows Completed, connect your applications to the new target Azure SQL Database.

後續步驟Next steps