使用 Data Migration Assistant 來執行 SQL Server 移轉評估Perform a SQL Server migration assessment with Data Migration Assistant

下列逐步指示可協助您執行第一次評量以遷移至內部部署 SQL Server、SQL Server 在 Azure VM 上執行,或使用 Data Migration Assistant Azure SQL Database。The following step-by-step instructions help you perform your first assessment for migrating to on-premises SQL Server, SQL Server running on an Azure VM, or Azure SQL Database by using Data Migration Assistant.

注意

Data Migration Assistant 5.0 版引進了在應用程式程式碼中分析資料庫連接和內嵌 SQL 查詢的支援。Data Migration Assistant v5.0 introduces support for analyzing database connectivity and embedded SQL queries in the application code. 如需詳細資訊,請參閱使用 Data Migration Assistant 的 blog 文章 來評估應用程式的資料存取層For more information, see the blog post Using Data Migration Assistant to assess an application’s data access layer.

建立評定Create an assessment

  1. 選取 的 (+) ] 圖示,然後選取 [ 評定 ] 專案類型。Select the New (+) icon, and then select the Assessment project type.

  2. 設定來源和目標伺服器類型。Set the source and target server type.

    如果您要將內部部署 SQL Server 實例升級到新式內部部署 SQL Server 實例或裝載于 Azure VM 上的 SQL Server,請將來源和目標伺服器類型設定為 SQL ServerIf you're upgrading your on-premises SQL Server instance to a modern on-premises SQL Server instance or to SQL Server hosted on an Azure VM, set the source and target server type to SQL Server. 如果您要遷移至 Azure SQL Database,請改為將目標伺服器類型設定為 Azure SQL DatabaseIf you're migrating to Azure SQL Database, instead set the target server type to Azure SQL Database.

  3. 按一下頁面底部的 [新增] 。Click Create.

    建立評定

選擇評量選項Choose assessment options

  1. 選取您打算遷移的目標 SQL Server 版本。Select the target SQL Server version to which you plan to migrate.

  2. 選取報表類型。Select the report type.

    當您評估來源 SQL Server 實例以遷移至內部部署 SQL Server 或裝載于 Azure VM 目標上的 SQL Server 時,您可以選擇下列其中一種或兩種評估報告類型:When you're assessing your source SQL Server instance for migrating to on-premises SQL Server or to SQL Server hosted on Azure VM targets, you can choose one or both of the following assessment report types:

    • 相容性問題Compatibility Issues
    • 新功能的建議New features' recommendation

    選取 SQL Server 目標的評量報告類型

    評定來源 SQL Server 實例以遷移至 Azure SQL Database 時,您可以選擇下列其中一種或兩種評估報告類型:When assessing your source SQL Server instance for migrating to Azure SQL Database, you can choose one or both of the following assessment report types:

    • 檢查資料庫相容性Check database compatibility
    • 檢查功能同位Check feature parity

    選取 SQL Database 目標的評定報告類型

新增資料庫和擴充事件追蹤以進行評估Add databases and extended events trace to assess

  1. 選取 [ 新增來源 ] 以開啟連接飛出視窗功能表。Select Add Sources to open the connection flyout menu.

  2. 輸入 SQL server 實例名稱,選擇驗證類型,設定正確的連接屬性,然後選取 [連接]Enter the SQL server instance name, choose the Authentication type, set the correct connection properties, and then select Connect.

  3. 選取要評估的資料庫,然後選取 [ 新增]。Select the databases to assess, and then select Add.

    注意

    您可以選取多個資料庫,同時按住 Shift 或 Ctrl 鍵,然後按一下 [ 移除來源],以移除多個資料庫。You can remove multiple databases by selecting them while holding the Shift or Ctrl key, and then clicking Remove Sources. 您也可以選取 [ 新增來源],以從多個 SQL Server 實例加入資料庫。You can also add databases from multiple SQL Server instances by selecting Add Sources.

  4. 如果您有任何特定或動態 SQL 查詢,或是透過應用程式資料層起始的任何 DML 語句,則請輸入您所收集之所有擴充事件會話檔案的資料夾路徑,以在來源 SQL Server 上抓取工作負載。If you have any ad hoc or dynamic SQL queries or any DML statements initiated through the application data layer, then enter the path to the folder in which you placed all the extended events session files that you collected to capture the workload on the source SQL Server.

    下列範例示範如何在來源 SQL Server 建立擴充的事件會話,以捕捉應用程式資料層工作負載。The following example shows how to create an extended event session on your source SQL Server to capture the application data layer workload. 在代表您尖峰工作負載的持續時間內捕獲工作負載。Capture the workload for the duration that represents your peak workload.

    DROP EVENT SESSION [DatalayerSession] ON SERVER
    go
    CREATE EVENT SESSION [DatalayerSession] ON SERVER  
    ADD EVENT sqlserver.sql_batch_completed( 
        ACTION (sqlserver.sql_text,sqlserver.client_app_name,sqlserver.client_hostname,sqlserver.database_id))
    ADD TARGET package0.asynchronous_file_target(SET filename=N'C:\temp\Demos\DataLayerAppassess\DatalayerSession.xel')  
    WITH (MAX_MEMORY=2048 KB,EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=3 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=OFF,STARTUP_STATE=OFF)
    go
    ---Start the session
    ALTER EVENT SESSION [DatalayerSession]
          ON SERVER
        STATE = START;
    ---Wait for few minutes
    
    ---Query events
    
        SELECT 
        object_name,
        CAST(event_data as xml) as event_data,
        file_name, 
        file_offset
    FROM sys.fn_xe_file_target_read_file('C:\temp\Demos\DataLayerAppassess\DatalayerSession*xel', 
                'C:\\temp\\Demos\\DataLayerAppassess\\DatalayerSession*xem', 
                null,
                null)
    ---Stop the session after capturing the peak load.
    ALTER EVENT SESSION [DatalayerSession]
          ON SERVER
        STATE = STOP;
    
        go
    
  5. 按 [下一步] 開始進行評估。Click Next to start the assessment.

    新增來源並開始評量

注意

您可以同時執行多個評估,並開啟 [所有評估] 頁面來檢視這些評估的狀態。You can run multiple assessments concurrently and view the state of the assessments by opening the All Assessments page.

檢視結果View results

評量的持續時間取決於新增的資料庫數目和每個資料庫的架構大小。The duration of the assessment depends on the number of databases added and the schema size of each database. 當每個資料庫可用時,就會顯示結果。Results are displayed for each database as soon as they're available.

  1. 選取已完成評量的資料庫,然後使用切換器在 相容性問題功能建議 之間切換。Select the database that has completed the assessment, and then switch between Compatibility issues and Feature recommendations by using the switcher.

  2. 檢查您在 [ 選項 ] 頁面上選取之目標 SQL Server 版本所支援之所有相容性層級的相容性問題。Review the compatibility issues across all compatibility levels supported by the target SQL Server version that you selected on the Options page.

您可以藉由分析受影響的物件、其詳細資料,以及可能會修正 中斷變更行為變更 和已 淘汰功能 所識別的每個問題,來查看相容性問題。You can review compatibility issues by analyzing the affected object, its details, and potentially a fix for every issue identified under Breaking changes, Behavior changes, and Deprecated features.

查看評量結果

同樣地,您可以跨 效能儲存體安全性 區域查看功能建議。Similarly, you can review feature recommendation across Performance, Storage, and Security areas.

功能建議涵蓋各種不同的功能,例如 In-Memory OLTP、資料行存放區、Stretch Database、Always Encrypted、動態資料遮罩和透明資料加密。Feature recommendations cover different kinds of features such as In-Memory OLTP, Columnstore, Stretch Database, Always Encrypted, Dynamic Data Masking, and Transparent Data Encryption.

查看功能建議

針對 Azure SQL Database,評量可提供遷移封鎖問題和功能同位問題。For Azure SQL Database, the assessments provide migration blocking issues and feature parity issues. 選取特定選項來檢查這兩個類別的結果。Review the results for both categories by selecting the specific options.

  • SQL Server 功能 同位分類提供一組完整的建議、Azure 中可用的替代方法,以及緩和步驟。The SQL Server feature parity category provides a comprehensive set of recommendations, alternative approaches available in Azure, and mitigating steps. 它可協助您在遷移專案中規劃這項工作。It helps you plan this effort in your migration projects.

    查看 SQL Server 功能同位的資訊

  • 相容性問題 類別提供部分支援或不支援的功能,以防止將內部部署 SQL Server 資料庫移轉至 Azure SQL 資料庫。The Compatibility issues category provides partially supported or unsupported features that block migrating on-premises SQL Server databases to Azure SQL databases. 接著,它會提供建議來協助您解決這些問題。It then provides recommendations to help you address those issues.

    查看相容性問題

評估資料資產的目標就緒程度Assess a data estate for target readiness

如果您想要進一步將這些評定延伸至整個資料資產,並找出 SQL Server 實例和資料庫的相對就緒程度,以便遷移至 Azure SQL Database,請選取 [上傳至 Azure Migrate],將結果上傳至 Azure Migrate 中樞。If you want further extend these assessments to the entire data estate and find the relative readiness of SQL Server instances and databases for migration to Azure SQL Database, upload the results to the Azure Migrate hub by selecting Upload to Azure Migrate.

這樣做可讓您在 Azure Migrate 中樞專案上查看合併的結果。Doing so allows you to view the consolidated results on the Azure Migrate hub project.

您可以 在這裡找到目標就緒程度評定的詳細逐步指引。Detailed, step-by-step guidance for target readiness assessments is available here.

將結果上傳至 Azure Migrate

匯出結果Export results

所有資料庫完成評量之後,請選取 [ 匯出報表 ],將結果匯出至 JSON 檔案或 CSV 檔案。After all databases finish the assessment, select Export report to export the results to either a JSON file or a CSV file. 然後您就可以自行分析資料。You can then analyze the data at your own convenience.

儲存並載入評量Save and load assessments

除了匯出評量的結果之外,您還可以將評量詳細資料儲存到檔案中,並載入評定檔以供稍後審核。In addition to exporting the results of an assessment, you can save assessment detail to a file and load an assessment file for later review. 如需詳細資訊,請參閱 使用 Data Migration Assistant 儲存和載入評量一文。For more information, see the article Save and load assessments with Data Migration Assistant.