共用方式為


az datamigration

注意

此參考是 Azure CLI 的 數據匯入 延伸模組的一部分(2.15.0 版或更高版本)。 擴充功能會在您第一次執行 az datamigration 命令時自動安裝。 深入瞭解擴充功能

管理數據遷移。

命令

名稱 Description 類型 狀態
az datamigration get-assessment

在 SQL Server 實例上啟動評量。

外延 加語
az datamigration get-sku-recommendation

提供 Azure SQL 供應專案的 SKU 建議。

外延 加語
az datamigration login-migration

將登入從來源 Sql Server 移轉至目標 Azure Sql Server。

外延 加語
az datamigration performance-data-collection

收集指定 SQL Server 實例的效能數據。

外延 加語
az datamigration register-integration-runtime

在 Integration Runtime 上註冊資料庫移轉服務。

外延 加語
az datamigration sql-db

管理資料庫移轉至 SQL DB。

外延 加語
az datamigration sql-db cancel

停止進行中的資料庫移轉至 SQL DB。

外延 加語
az datamigration sql-db create

建立新的資料庫移轉至指定的 SQL Db。 此命令可以將數據從選取的源資料庫數據表遷移至目標資料庫數據表。 如果目標資料庫沒有現有的數據表,請使用 New-AzDataMigrationSqlServerSchema 命令,將架構物件從源資料庫移轉至目標 databse。 New-AzDataMigrationSqlServerSchema 連結 https://learn.microsoft.com/cli/azure/datamigration?view=azure-cli-latest#az-datamigration-sql-server-schema

外延 加語
az datamigration sql-db delete

刪除進行中或已完成的資料庫移轉至 SQL DB。

外延 加語
az datamigration sql-db show

擷取指定 SQL DB 的指定資料庫移轉。

外延 加語
az datamigration sql-db wait

將 CLI 置於等候狀態,直到符合數據匯入 sql-db 的條件為止。

外延 加語
az datamigration sql-managed-instance

管理資料庫移轉至 SQL 受控實例。

外延 加語
az datamigration sql-managed-instance cancel

停止進行中的資料庫移轉至 SQL 受控實例。

外延 加語
az datamigration sql-managed-instance create

建立新的資料庫移轉至指定的 SQL 受控實例。

外延 加語
az datamigration sql-managed-instance cutover

起始進行中的在線資料庫移轉至 SQL 受控實例的完全移轉。

外延 加語
az datamigration sql-managed-instance show

擷取指定 SQL 受控實例的指定資料庫移轉。

外延 加語
az datamigration sql-managed-instance wait

將 CLI 置於等候狀態,直到符合 sql-managed-instance 的數據匯入條件為止。

外延 加語
az datamigration sql-server-schema

將架構從來源 Sql Server 移轉至目標 Azure Sql Server。

外延 加語
az datamigration sql-service

管理資料庫移轉服務。

外延 加語
az datamigration sql-service create

建立資料庫移轉服務。

外延 加語
az datamigration sql-service delete

刪除資料庫移轉服務。

外延 加語
az datamigration sql-service delete-node

刪除整合運行時間節點。

外延 加語
az datamigration sql-service list

擷取資源群組中的所有資料庫移轉服務。 並擷取訂用帳戶中的所有資料庫移轉服務。

外延 加語
az datamigration sql-service list-auth-key

擷取自我裝載整合運行時間的驗證金鑰清單。

外延 加語
az datamigration sql-service list-integration-runtime-metric

擷取已註冊的Integration Runtine節點及其指定資料庫移轉服務的監視數據。

外延 加語
az datamigration sql-service list-migration

擷取附加至服務的資料庫移轉清單。

外延 加語
az datamigration sql-service regenerate-auth-key

重新產生自我裝載整合運行時間的新驗證金鑰集。

外延 加語
az datamigration sql-service show

擷取資料庫移轉服務。

外延 加語
az datamigration sql-service update

更新資料庫移轉服務。

外延 加語
az datamigration sql-service wait

將 CLI 置於等候狀態,直到符合數據匯入 sql-service 的條件為止。

外延 加語
az datamigration sql-vm

管理資料庫移轉至 SQL VM。

外延 加語
az datamigration sql-vm cancel

停止進行中的資料庫移轉至 SQL VM。

外延 加語
az datamigration sql-vm create

建立新的資料庫移轉至指定的 SQL VM。

外延 加語
az datamigration sql-vm cutover

起始進行中的在線資料庫移轉至 SQL VM 的完全移轉。

外延 加語
az datamigration sql-vm show

擷取指定 SQL VM 的指定資料庫移轉。

外延 加語
az datamigration sql-vm wait

將 CLI 置於等候狀態,直到符合數據匯入 sql-vm 的條件為止。

外延 加語
az datamigration tde-migration

將 TDE 憑證從來源 SQL Server 遷移至目標 Azure SQL Server。

外延 加語

az datamigration get-assessment

在 SQL Server 實例上啟動評量。

az datamigration get-assessment [--config-file-path]
                                [--connection-string]
                                [--output-folder]
                                [--overwrite]

範例

使用連接字串在指定的 SQL Server 上執行 SQL 評定。

az datamigration get-assessment --connection-string "Data Source=LabServer.database.net;Initial Catalog=master;Integrated Security=False;User Id=User;Password=password" --output-folder "C:\AssessmentOutput" --overwrite

使用評量組態檔,在指定的 SQL Server 上執行 SQL 評定。

az datamigration get-assessment --config-file-path "C:\Users\user\document\config.json"

使用連接字串在一次呼叫中對多個 SQL Server 執行 SQL 評定。

az datamigration get-assessment --connection-string "Data Source=LabServer1.database.net;Initial Catalog=master;Integrated Security=False;User Id=User;Password=password" "Data Source=LabServer2.database.net;Initial Catalog=master;Integrated Security=False;User Id=User;Password=password" --output-folder "C:\AssessmentOutput" --overwrite

選擇性參數

--config-file-path

ConfigFile 的路徑。

--connection-string

SQL Server 連接字串。

--output-folder

用來儲存評估報告的輸出資料夾。

--overwrite

啟用此參數以覆寫現有的評估報告。

預設值: False
全域參數
--debug

增加記錄詳細信息以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄詳細資訊。 針對完整偵錯記錄使用 --debug。

az datamigration get-sku-recommendation

提供 Azure SQL 供應專案的 SKU 建議。

az datamigration get-sku-recommendation [--config-file-path]
                                        [--database-allow-list]
                                        [--database-deny-list]
                                        [--display-result]
                                        [--elastic-strategy]
                                        [--end-time]
                                        [--output-folder]
                                        [--overwrite]
                                        [--scaling-factor]
                                        [--start-time]
                                        [--target-percentile]
                                        [--target-platform]
                                        [--target-sql-instance]

範例

使用命令列取得指定 SQL Server 的 SKU 建議。

az datamigration get-sku-recommendation --output-folder "C:\PerfCollectionOutput" --database-allow-list AdventureWorks1 AdventureWorks2 --display-result --overwrite

使用評量組態檔取得指定 SQL Server 的 SKU 建議。

az datamigration get-sku-recommendation --config-file-path "C:\Users\user\document\config.json"

選擇性參數

--config-file-path

ConfigFile 的路徑。

--database-allow-list

在排除所有其他資料庫時,允許針對SKU建議考慮的資料庫名稱分隔清單。 只設定下列其中一項或兩者:databaseAllowList、databaseDenyList。 默認值:null。

--database-deny-list

未考慮 SKU 建議之資料庫名稱的空間分隔清單。 只設定下列其中一項或兩者:databaseAllowList、databaseDenyList。 默認值:null。

--display-result

是否要將 SKU 建議結果列印至主控台。 啟用此參數以顯示結果。

預設值: False
--elastic-strategy

是否根據資源使用量分析,針對 SKU 建議使用彈性策略。 啟用此參數以使用彈性策略。

預設值: False
--end-time

匯總期間要考慮的 UTC 效能數據點結束時間,採用 YYYY-MM-DD HH:MM 格式。 僅適用於基準(非彈性)策略。 預設值:將考慮收集的所有數據點。

--output-folder

儲存 SQL Server 效能資料的輸出資料夾。 這裡的值必須與 PerfDataCollection 中使用的值相同。

--overwrite

是否要覆寫任何現有的 SKU 建議報告。 啟用此參數以覆寫。

預設值: False
--scaling-factor

SKU 建議期間使用的縮放比例(舒適)因素。 例如,如果判斷有 4 個虛擬核心 CPU 需求,且縮放比例為 150%,則真正的 CPU 需求會是 6 個虛擬核心。

預設值: 100
--start-time

匯總期間要考慮的效能數據點 UTC 開始時間,採用 YYYY-MM-DD HH:MM 格式。 僅適用於基準(非彈性)策略。 預設值:將考慮收集的所有數據點。

--target-percentile

效能數據匯總期間所要使用的數據點百分位數。 僅適用於基準(非彈性)策略。

預設值: 95
--target-platform

SKU 建議的目標平臺:AzureSqlDatabase、AzureSqlManagedInstance、AzureSqlVirtualMachine 或 Any。 如果選取 [任何],則會評估所有三個目標平臺的 SKU 建議,並傳回最適合的 SKU 建議。

預設值: Any
--target-sql-instance

建議使用 SKU 的 SQL 實例名稱。 默認值:outputFolder 將會掃描 PerfDataCollection 動作所建立的檔案,並針對找到的每個實例提供建議。

全域參數
--debug

增加記錄詳細信息以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄詳細資訊。 針對完整偵錯記錄使用 --debug。

az datamigration login-migration

將登入從來源 Sql Server 移轉至目標 Azure Sql Server。

az datamigration login-migration [--aad-domain-name]
                                 [--config-file-path]
                                 [--csv-file-path]
                                 [--list-of-login]
                                 [--output-folder]
                                 [--src-sql-connection-str]
                                 [--tgt-sql-connection-str]

範例

使用參數,執行將登入從來源 Sql Server 移轉至目標 Azure Sql Server。

az datamigration login-migration --src-sql-connection-str  "data source=servername;user id=userid;password=;initial catalog=master;TrustServerCertificate=True" --tgt-sql-connection-str  "data source=servername;user id=userid;password=;initial catalog=master;TrustServerCertificate=True" --csv-file-path "C:\CSVFile" --list-of-login "loginname1" "loginname2" --output-folder "C:\OutputFolder" --aad-domain-name "AADDomainName"

使用組態檔,執行將登入從來源 Sql Server 移轉至目標 Azure Sql Server。

az datamigration login-migration --config-file-path "C:\Users\user\document\config.json"

選擇性參數

--aad-domain-name

如果要移轉的登入清單中包含 Windows 登入,則為必要專案。

--config-file-path

ConfigFile 的路徑。

--csv-file-path

登入 CSV 檔案的位置。 在此和 listOfLogin 之間只使用一個參數。

--list-of-login

字串格式的登入清單。 如果需要移轉大量的登入,請使用 CSV 檔案選項。

--output-folder

默認值:%LocalAppData%/Microsoft/SqlLoginMigrations) 將寫入記錄的資料夾。

--src-sql-connection-str

來源 SQL 實例的連接字串(s),使用正式連接字串格式。

--tgt-sql-connection-str

目標 SQL 實例的連接字串(s),使用正式連接字串格式。

全域參數
--debug

增加記錄詳細信息以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄詳細資訊。 針對完整偵錯記錄使用 --debug。

az datamigration performance-data-collection

收集指定 SQL Server 實例的效能數據。

az datamigration performance-data-collection [--config-file-path]
                                             [--connection-string]
                                             [--number-of-iteration]
                                             [--output-folder]
                                             [--perf-query-interval]
                                             [--static-query-interval]
                                             [--time]

範例

使用連接字串收集指定 SQL Server 的效能數據。

az datamigration performance-data-collection --connection-string "Data Source=LabServer.database.net;Initial Catalog=master;Integrated Security=False;User Id=User;Password=password" --output-folder "C:\PerfCollectionOutput" --number-of-iteration 5 --perf-query-interval 10 --static-query-interval 60

使用連接字串,在一次呼叫中收集多個 SQL Server 的效能數據。

az datamigration performance-data-collection --connection-string "Data Source=LabServer1.database.net;Initial Catalog=master;Integrated Security=False;User Id=User;Password=password" "Data Source=LabServer2.database.net;Initial Catalog=master;Integrated Security=False;User Id=User;Password=password" --output-folder "C:\PerfCollectionOutput" --number-of-iteration 5 --perf-query-interval 10 --static-query-interval 60

使用評量組態檔收集指定 SQL Server 的效能數據。

az datamigration performance-data-collection --config-file-path "C:\Users\user\document\config.json"

藉由指定時間限制來收集指定 SQL Server 的效能數據。 如果指定的時間限制是在反覆項目週期的列舉之前,進程將會結束,而不會儲存最後一個週期效能數據。

az datamigration performance-data-collection --connection-string "Data Source=LabServer.database.net;Initial Catalog=master;Integrated Security=False;User Id=User;Password=password" --output-folder "C:\PerfCollectionOutput" --number-of-iteration 5 --perf-query-interval 10 --static-query-interval 60 --time 60

選擇性參數

--config-file-path

ConfigFile 的路徑。

--connection-string

SQL Server 連接字串。

--number-of-iteration

在保存至檔案之前,要執行的效能數據收集反覆項目數目。 例如,使用預設值時,效能數據會每 30 秒保存一次 * 20 次反覆運算 = 10 分鐘。 最小值:2。

預設值: 20
--output-folder

用來儲存效能資料的輸出資料夾。

--perf-query-interval

查詢效能數據的間隔,以秒為單位。

預設值: 30
--static-query-interval

查詢和保存靜態組態數據的間隔,以秒為單位。

預設值: 3600
--time

命令執行會在幾秒後自動停止的時間。 如果未指定此參數,則需要手動介入,才能停止命令執行。

全域參數
--debug

增加記錄詳細信息以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄詳細資訊。 針對完整偵錯記錄使用 --debug。

az datamigration register-integration-runtime

在 Integration Runtime 上註冊資料庫移轉服務。

az datamigration register-integration-runtime --auth-key
                                              [--installed-ir-path]
                                              [--ir-path]

範例

在自我裝載整合運行時間上註冊 Sql 移轉服務。

az datamigration register-integration-runtime --auth-key "IR@00000-0000000-000000-aaaaa-bbbb-cccc"

安裝 Integration Runtime,並在其上安裝 Sql 移轉服務。

az datamigration register-integration-runtime --auth-key "IR@00000-0000000-000000-aaaaa-bbbb-cccc" --ir-path "C:\Users\user\Downloads\IntegrationRuntime.msi"

從指定的安裝位置讀取 Integration Runtime。

az datamigration register-integration-runtime --auth-key "IR@00000-0000000-000000-aaaaa-bbbb-cccc" --installed-ir-path "D:\My Softwares\Microsoft Integration Runtime\5.0"

必要參數

--auth-key

SQL 移轉服務的 AuthKey。

選擇性參數

--installed-ir-path

Integration Runtime 安裝位置中的版本資料夾路徑。 這可以在安裝 IR 時提供,但命令無法讀取。 格式:<Parent-folder-path>\Microsoft Integration Runtime\<Version>

--ir-path

Integration Runtime MSI 的路徑。

全域參數
--debug

增加記錄詳細信息以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄詳細資訊。 針對完整偵錯記錄使用 --debug。

az datamigration sql-server-schema

將架構從來源 Sql Server 移轉至目標 Azure Sql Server。

az datamigration sql-server-schema [--action {DeploySchema, GenerateScript, MigrateSchema}]
                                   [--config-file-path]
                                   [--input-script-file-path]
                                   [--output-folder]
                                   [--src-sql-connection-str]
                                   [--tgt-sql-connection-str]

範例

執行 使用參數將資料庫物件從來源 SQL Server 移轉至目標 Azure SQL Database。

az datamigration sql-server-schema --action "MigrateSchema" --src-sql-connection-str "Server=;Initial Catalog=;User ID=;Password=" --tgt-sql-connection-str "Server=;Initial Catalog=;User ID=;Password="

使用參數從來源 SQL Server 執行產生 TSQL 架構腳本。

az datamigration sql-server-schema --action "GenerateScript" --src-sql-connection-str "Server=;Initial Catalog=;User ID=;Password=" --tgt-sql-connection-str "Server=;Initial Catalog=;User ID=;Password="  --output-folder "C:\OutputFolder"

使用參數將 TSQL 腳本部署至目標 Azure SQL Database。

az datamigration sql-server-schema --action "GenerateScript" --src-sql-connection-str "Server=;Initial Catalog=;User ID=;Password=" --tgt-sql-connection-str "Server=;Initial Catalog=;User ID=;Password="  --input-script-file-path "C:\OutputFolder\script.sql"

使用 ConfigFile 執行將資料庫物件從來源 SQL Server 移轉至目標 Azure SQL Database。

az datamigration sql-server-schema --config-file-path "C:\configfile.json"

選擇性參數

--action

選取一個架構移轉動作。 MigrateSchema 是將資料庫物件遷移至 Azure SQL Database 目標。 GenerateScript 是產生可編輯的 TSQL 架構腳本,可用來在目標上執行以部署物件。 DeploySchema 是執行從目標上 -GenerateScript 動作產生的 TSQL 腳本,以部署物件。

接受的值: DeploySchema, GenerateScript, MigrateSchema
--config-file-path

ConfigFile 的路徑。 configfile.json 中接受的參數名稱為 Action、sourceConnectionString、targetConnectionString、inputScriptFilePath 和 outputFolder。

--input-script-file-path

可編輯 TSQL 架構文本的位置。 僅搭配 DeploySchema Action 使用此參數。

--output-folder

默認值:%LocalAppData%/Microsoft/SqlSchemaMigration) 將寫入記錄的資料夾,以及產生腳本動作所產生的 TSQL 架構腳本。

--src-sql-connection-str

來源 SQL 實例的連接字串,使用正式連接字串格式。

--tgt-sql-connection-str

目標 SQL 實例的連接字串,使用正式連接字串格式。

全域參數
--debug

增加記錄詳細信息以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄詳細資訊。 針對完整偵錯記錄使用 --debug。

az datamigration tde-migration

將 TDE 憑證從來源 SQL Server 遷移至目標 Azure SQL Server。

az datamigration tde-migration [--database-name]
                               [--network-share-domain]
                               [--network-share-password]
                               [--network-share-path]
                               [--network-share-user-name]
                               [--source-sql-connection-string]
                               [--target-managed-instance-name]
                               [--target-resource-group-name]
                               [--target-subscription-id]

範例

將 TDE 憑證從來源 SQL Server 遷移至目標 Azure SQL Server。

az datamigration tde-migration --source-sql-connection-string "data source=servername;user id=userid;password=;initial catalog=master;TrustServerCertificate=True" --target-subscription-id "00000000-0000-0000-0000-000000000000" --target-resource-group-name "ResourceGroupName" --target-managed-instance-name "TargetManagedInstanceName" --network-share-path "\NetworkShare\Folder" --network-share-domain "NetworkShare" --network-share-user-name "NetworkShareUserName" --network-share-password "" --database-name "TdeDb_0" "TdeDb_1" "TdeDb_2"

選擇性參數

--database-name --dbname

源資料庫名稱。

--network-share-domain --networkdomain

網路共用網域。

--network-share-password --networkpw

網路共享密碼。

--network-share-path --networkpath

網路共享路徑。

--network-share-user-name --networkuser

網路共用用戶名稱。

--source-sql-connection-string --srcsqlcs

來源 SQL 實例的連接字串,使用正式連接字串格式。

--target-managed-instance-name --tgtname

Azure SQL Server 的名稱。

--target-resource-group-name --tgtrg

目標 Azure SQL 伺服器的資源組名。

--target-subscription-id --tgtsubscription

目標 Azure SQL 伺服器的訂用帳戶標識碼。

全域參數
--debug

增加記錄詳細信息以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄詳細資訊。 針對完整偵錯記錄使用 --debug。