az datamigration
注意
此參考是 Azure CLI 的 數據匯入 延伸模組的一部分(2.15.0 版或更高版本)。 擴充功能會在您第一次執行 az datamigration 命令時自動安裝。 深入瞭解擴充功能。
管理數據遷移。
命令
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
選擇性參數
ConfigFile 的路徑。
SQL Server 連接字串。
用來儲存評估報告的輸出資料夾。
啟用此參數以覆寫現有的評估報告。
全域參數
增加記錄詳細信息以顯示所有偵錯記錄。
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
輸出格式。
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID
來設定預設訂用帳戶。
增加記錄詳細資訊。 針對完整偵錯記錄使用 --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"
選擇性參數
ConfigFile 的路徑。
在排除所有其他資料庫時,允許針對SKU建議考慮的資料庫名稱分隔清單。 只設定下列其中一項或兩者:databaseAllowList、databaseDenyList。 默認值:null。
未考慮 SKU 建議之資料庫名稱的空間分隔清單。 只設定下列其中一項或兩者:databaseAllowList、databaseDenyList。 默認值:null。
是否要將 SKU 建議結果列印至主控台。 啟用此參數以顯示結果。
是否根據資源使用量分析,針對 SKU 建議使用彈性策略。 啟用此參數以使用彈性策略。
匯總期間要考慮的 UTC 效能數據點結束時間,採用 YYYY-MM-DD HH:MM 格式。 僅適用於基準(非彈性)策略。 預設值:將考慮收集的所有數據點。
儲存 SQL Server 效能資料的輸出資料夾。 這裡的值必須與 PerfDataCollection 中使用的值相同。
是否要覆寫任何現有的 SKU 建議報告。 啟用此參數以覆寫。
SKU 建議期間使用的縮放比例(舒適)因素。 例如,如果判斷有 4 個虛擬核心 CPU 需求,且縮放比例為 150%,則真正的 CPU 需求會是 6 個虛擬核心。
匯總期間要考慮的效能數據點 UTC 開始時間,採用 YYYY-MM-DD HH:MM 格式。 僅適用於基準(非彈性)策略。 預設值:將考慮收集的所有數據點。
效能數據匯總期間所要使用的數據點百分位數。 僅適用於基準(非彈性)策略。
SKU 建議的目標平臺:AzureSqlDatabase、AzureSqlManagedInstance、AzureSqlVirtualMachine 或 Any。 如果選取 [任何],則會評估所有三個目標平臺的 SKU 建議,並傳回最適合的 SKU 建議。
建議使用 SKU 的 SQL 實例名稱。 默認值:outputFolder 將會掃描 PerfDataCollection 動作所建立的檔案,並針對找到的每個實例提供建議。
全域參數
增加記錄詳細信息以顯示所有偵錯記錄。
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
輸出格式。
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID
來設定預設訂用帳戶。
增加記錄詳細資訊。 針對完整偵錯記錄使用 --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"
選擇性參數
如果要移轉的登入清單中包含 Windows 登入,則為必要專案。
ConfigFile 的路徑。
登入 CSV 檔案的位置。 在此和 listOfLogin 之間只使用一個參數。
字串格式的登入清單。 如果需要移轉大量的登入,請使用 CSV 檔案選項。
默認值:%LocalAppData%/Microsoft/SqlLoginMigrations) 將寫入記錄的資料夾。
來源 SQL 實例的連接字串(s),使用正式連接字串格式。
目標 SQL 實例的連接字串(s),使用正式連接字串格式。
全域參數
增加記錄詳細信息以顯示所有偵錯記錄。
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
輸出格式。
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID
來設定預設訂用帳戶。
增加記錄詳細資訊。 針對完整偵錯記錄使用 --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
選擇性參數
ConfigFile 的路徑。
SQL Server 連接字串。
在保存至檔案之前,要執行的效能數據收集反覆項目數目。 例如,使用預設值時,效能數據會每 30 秒保存一次 * 20 次反覆運算 = 10 分鐘。 最小值:2。
用來儲存效能資料的輸出資料夾。
查詢效能數據的間隔,以秒為單位。
查詢和保存靜態組態數據的間隔,以秒為單位。
命令執行會在幾秒後自動停止的時間。 如果未指定此參數,則需要手動介入,才能停止命令執行。
全域參數
增加記錄詳細信息以顯示所有偵錯記錄。
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
輸出格式。
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID
來設定預設訂用帳戶。
增加記錄詳細資訊。 針對完整偵錯記錄使用 --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"
必要參數
SQL 移轉服務的 AuthKey。
選擇性參數
Integration Runtime 安裝位置中的版本資料夾路徑。 這可以在安裝 IR 時提供,但命令無法讀取。 格式:<Parent-folder-path>\Microsoft Integration Runtime\<Version>
。
Integration Runtime MSI 的路徑。
全域參數
增加記錄詳細信息以顯示所有偵錯記錄。
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
輸出格式。
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID
來設定預設訂用帳戶。
增加記錄詳細資訊。 針對完整偵錯記錄使用 --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"
選擇性參數
選取一個架構移轉動作。 MigrateSchema 是將資料庫物件遷移至 Azure SQL Database 目標。 GenerateScript 是產生可編輯的 TSQL 架構腳本,可用來在目標上執行以部署物件。 DeploySchema 是執行從目標上 -GenerateScript 動作產生的 TSQL 腳本,以部署物件。
ConfigFile 的路徑。 configfile.json 中接受的參數名稱為 Action、sourceConnectionString、targetConnectionString、inputScriptFilePath 和 outputFolder。
可編輯 TSQL 架構文本的位置。 僅搭配 DeploySchema Action 使用此參數。
默認值:%LocalAppData%/Microsoft/SqlSchemaMigration) 將寫入記錄的資料夾,以及產生腳本動作所產生的 TSQL 架構腳本。
來源 SQL 實例的連接字串,使用正式連接字串格式。
目標 SQL 實例的連接字串,使用正式連接字串格式。
全域參數
增加記錄詳細信息以顯示所有偵錯記錄。
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
輸出格式。
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID
來設定預設訂用帳戶。
增加記錄詳細資訊。 針對完整偵錯記錄使用 --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"
選擇性參數
源資料庫名稱。
網路共用網域。
網路共享密碼。
網路共享路徑。
網路共用用戶名稱。
來源 SQL 實例的連接字串,使用正式連接字串格式。
Azure SQL Server 的名稱。
目標 Azure SQL 伺服器的資源組名。
目標 Azure SQL 伺服器的訂用帳戶標識碼。
全域參數
增加記錄詳細信息以顯示所有偵錯記錄。
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
輸出格式。
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID
來設定預設訂用帳戶。
增加記錄詳細資訊。 針對完整偵錯記錄使用 --debug。