az datamigration sql-managed-instance
Note
此參考是 Azure CLI (2.75.0 版或更新版本) 資料 移轉 延伸模組的一部分。 擴充功能會在您第一次執行 az datamigration sql-managed-instance 命令時自動安裝。 深入了解擴充功能。
管理 SQL 受控執行個體。
命令
| 名稱 | Description | 類型 | 狀態 |
|---|---|---|---|
| az datamigration sql-managed-instance cancel |
停止進行中的資料庫移轉至 SQL 受控實例。 |
Extension | GA |
| az datamigration sql-managed-instance create |
建立新的資料庫移轉至指定的 SQL 受控實例。 |
Extension | GA |
| az datamigration sql-managed-instance cutover |
起始進行中的在線資料庫移轉至 SQL 受控實例的完全移轉。 |
Extension | GA |
| az datamigration sql-managed-instance delete |
刪除資料庫移轉資源。 |
Extension | GA |
| az datamigration sql-managed-instance show |
擷取指定 SQL 受控實例的指定資料庫移轉。 |
Extension | GA |
| az datamigration sql-managed-instance wait |
將 CLI 置於等候狀態,直到符合 sql-managed-instance 的數據匯入條件為止。 |
Extension | GA |
az datamigration sql-managed-instance cancel
停止進行中的資料庫移轉至 SQL 受控實例。
az datamigration sql-managed-instance cancel --migration-operation-id
[--ids]
[--managed-instance-name]
[--no-wait]
[--resource-group]
[--subscription]
[--target-db-name]
範例
停止資料庫進行中的移轉。
az datamigration sql-managed-instance cancel --managed-instance-name "managedInstance1" --migration-operation-id "4124fe90-d1b6-4b50-b4d9-46d02381f59a" --resource-group "testrg" --target-db-name "db1"
必要參數
標識元追蹤移轉作業。
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
目標 SQL 受控實例的名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
請勿等候長時間執行的作業完成。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
目標資料庫的名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az datamigration sql-managed-instance create
建立新的資料庫移轉至指定的 SQL 受控實例。
az datamigration sql-managed-instance create --managed-instance-name
--resource-group
--target-db-name
[--migration-service]
[--no-wait]
[--offline-configuration]
[--scope]
[--source-database-name]
[--source-location]
[--source-sql-connection]
[--target-db-collation]
[--target-location]
範例
建立或更新檔案共享作為備份檔來源的資料庫移轉資源。
az datamigration sql-managed-instance create --managed-instance-name "managedInstance1" --source-location '{\"fileShare\":{\"path\":\"\\\\SharedBackup\\user\",\"password\":\"placeholder\",\"username\":\"Server\\name\"}}' --target-location account-key="abcd" storage-account-resource-id="account.database.windows.net" --migration-service "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent" --offline-configuration last-backup-name="last_backup_file_name" offline=true --scope "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/instance" --source-database-name "aaa" --source-sql-connection authentication="WindowsAuthentication" data-source="aaa" encrypt-connection=true password="placeholder" trust-server-certificate=true user-name="bbb" --resource-group "testrg" --target-db-name "db1"
使用 Azure Blob 記憶體作為備份檔的來源,建立或更新資料庫移轉資源。
az datamigration sql-managed-instance create --managed-instance-name "managedInstance1" --source-location '{\"AzureBlob\":{\"storageAccountResourceId\":\"/subscriptions/1111-2222-3333-4444/resourceGroups/RG/prooviders/Microsoft.Storage/storageAccounts/MyStorage\",\"accountKey\":\"======AccountKey====\",\"blobContainerName\":\"ContainerName-X\"}}' --migration-service "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent" --offline-configuration last-backup-name="last_backup_file_name" offline=true --scope "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/instance" --source-database-name "aaa" --source-sql-connection authentication="WindowsAuthentication" data-source="aaa" encrypt-connection=true password="placeholder" trust-server-certificate=true user-name="bbb" --resource-group "testrg" --target-db-name "db1"
使用 Azure Blob 記憶體建立或更新資料庫移轉資源(透過 System-Assigned 受控識別)作為備份來源。
az datamigration sql-managed-instance create --managed-instance-name "managedInstance1" --source-location '{\"AzureBlob\":{\"storageAccountResourceId\":\"/subscriptions/1111-2222-3333-4444/resourceGroups/RG/prooviders/Microsoft.Storage/storageAccounts/MyStorage\",\"authType\":\"ManagedIdentity\",\"identity\":{\"type\":\"SystemAssigned\"},\"blobContainerName\":\"ContainerName-X\"}}' --migration-service "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent" --offline-configuration last-backup-name="last_backup_file_name" offline=true --scope "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/instance" --source-database-name "aaa" --source-sql-connection authentication="WindowsAuthentication" data-source="aaa" encrypt-connection=true password="placeholder" trust-server-certificate=true user-name="bbb" --resource-group "testrg" --target-db-name "db1"
使用 Azure Blob 記憶體建立或更新資料庫移轉資源(透過 User-Assigned 受控識別)作為備份來源。
az datamigration sql-managed-instance create --managed-instance-name "managedInstance1" --source-location '{\"AzureBlob\":{\"storageAccountResourceId\":\"/subscriptions/1111-2222-3333-4444/resourceGroups/RG/prooviders/Microsoft.Storage/storageAccounts/MyStorage\",\"authType\":\"ManagedIdentity\",\"identity\":{\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"/subscriptions/00000000-1111-2222-3333-444444444444/resourcegroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-uami":{}}},\"blobContainerName\":\"ContainerName-X\"}}' --migration-service "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent" --offline-configuration last-backup-name="last_backup_file_name" offline=true --scope "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/instance" --source-database-name "aaa" --source-sql-connection authentication="WindowsAuthentication" data-source="aaa" encrypt-connection=true password="placeholder" trust-server-certificate=true user-name="bbb" --resource-group "testrg" --target-db-name "db1"
必要參數
目標 SQL 受控實例的名稱。
資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。
目標資料庫的名稱。
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
移轉服務的資源標識碼。
請勿等候長時間執行的作業完成。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
離線設定。
使用方式:--offline-configuration offline=XX last-backup-name=XX
離線:離線移轉 last-backup-name:離線移轉的最後備份名稱。 這是從檔案共享移轉的選擇性專案。 如果未提供,服務會根據檔案共享中出現的最新備份文件來判斷最後一個備份檔名。
目標資源的資源識別碼(SQL VM、SQL 受控實例或 SQL DB)。
源資料庫的名稱。
備份的來源位置。 預期值:json-string/json-file/@json-file。
| 屬性 | 值 |
|---|---|
| 參數群組: | Backup Configuration Arguments |
來源 SQL Server 連線詳細數據。
使用方式:--source-sql-connection data-source=XX authentication=XX user-name=XX password=XX encrypt-connection=XX trust-server-certificate=XX
數據源:數據源。 驗證:驗證類型。 user-name:連線至來源 SQL 的用戶名稱。 password:連線至來源 SQL 的密碼。 encrypt-connection:是否要加密連線。 trust-server-certificate:是否要信任伺服器證書。
要用於目標資料庫的資料庫定序。
複製備份的目標位置。
使用量:--target-location storage-account-resource-id=XX account-key=XX
storage-account-resource-id:複製備份之記憶體帳戶的資源標識符。 account-key:記憶體帳戶密鑰。
| 屬性 | 值 |
|---|---|
| 參數群組: | Backup Configuration Arguments |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az datamigration sql-managed-instance cutover
起始進行中的在線資料庫移轉至 SQL 受控實例的完全移轉。
az datamigration sql-managed-instance cutover --migration-operation-id
[--ids]
[--managed-instance-name]
[--no-wait]
[--resource-group]
[--subscription]
[--target-db-name]
範例
資料庫完全線上移轉作業。
az datamigration sql-managed-instance cutover --managed-instance-name "managedInstance1" --migration-operation-id "4124fe90-d1b6-4b50-b4d9-46d02381f59a" --resource-group "testrg" --target-db-name "db1"
必要參數
標識元追蹤移轉作業。
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
目標 SQL 受控實例的名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
請勿等候長時間執行的作業完成。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
目標資料庫的名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az datamigration sql-managed-instance delete
刪除資料庫移轉資源。
az datamigration sql-managed-instance delete [--force {0, 1, f, false, n, no, t, true, y, yes}]
[--ids]
[--managed-instance-name]
[--name --target-db-name]
[--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
[--resource-group]
[--subscription]
[--yes]
範例
刪除具有最小參數的資料庫移轉資源。
az datamigration sql-managed-instance delete --resource-group testrg --managed-instance-name managedInstance1 --target-db-name db1
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
選擇性強制刪除布爾值。 如果這是為 true,即使使用中,也會刪除移轉。
| 屬性 | 值 |
|---|---|
| 接受的值: | 0, 1, f, false, n, no, t, true, y, yes |
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
SQL 受控執行個體的名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
目標資料庫的名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
請勿等候長時間執行的作業完成。
| 屬性 | 值 |
|---|---|
| 接受的值: | 0, 1, f, false, n, no, t, true, y, yes |
Azure 資源群組的名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
請勿提示確認。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az datamigration sql-managed-instance show
擷取指定 SQL 受控實例的指定資料庫移轉。
az datamigration sql-managed-instance show [--expand]
[--ids]
[--managed-instance-name]
[--migration-operation-id]
[--resource-group]
[--subscription]
[--target-db-name]
範例
使用 expand 參數取得 Sql MI 資料庫移轉。
az datamigration sql-managed-instance show --expand "MigrationStatusDetails" --managed-instance-name "managedInstance1" --resource-group "testrg" --target-db-name "db1"
取得不含 expand 參數的 Sql MI 資料庫移轉。
az datamigration sql-managed-instance show --managed-instance-name "managedInstance1" --resource-group "testrg" --target-db-name "db1"
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
回應中會包含完整的移轉詳細數據。
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
目標 SQL 受控實例的名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
選擇性移轉作業標識碼。 如果提供,則會擷取該標識碼的移轉作業詳細數據。 如果未提供 (預設值),則會擷取與最近或目前作業相關的詳細數據。
資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
目標資料庫的名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az datamigration sql-managed-instance wait
將 CLI 置於等候狀態,直到符合 sql-managed-instance 的數據匯入條件為止。
az datamigration sql-managed-instance wait [--created]
[--custom]
[--deleted]
[--exists]
[--expand]
[--ids]
[--interval]
[--managed-instance-name]
[--migration-operation-id]
[--resource-group]
[--subscription]
[--target-db-name]
[--timeout]
[--updated]
範例
暫停執行下一行 CLI 腳本,直到成功建立數據匯入 sql-managed-instance 為止。
az datamigration sql-managed-instance wait --managed-instance-name "managedInstance1" --resource-group "testrg" --target-db-name "db1" --created
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
請等候在 'Succeeded' 使用 'provisioningState' 建立。
| 屬性 | 值 |
|---|---|
| 參數群組: | Wait Condition Arguments |
| 預設值: | False |
等到條件符合自定義 JMESPath 查詢為止。 例如 provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running']。
| 屬性 | 值 |
|---|---|
| 參數群組: | Wait Condition Arguments |
等到刪除為止。
| 屬性 | 值 |
|---|---|
| 參數群組: | Wait Condition Arguments |
| 預設值: | False |
等候資源存在。
| 屬性 | 值 |
|---|---|
| 參數群組: | Wait Condition Arguments |
| 預設值: | False |
回應中會包含完整的移轉詳細數據。
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
輪詢間隔以秒為單位。
| 屬性 | 值 |
|---|---|
| 參數群組: | Wait Condition Arguments |
| 預設值: | 30 |
目標 SQL 受控實例的名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
選擇性移轉作業標識碼。 如果提供,則會擷取該標識碼的移轉作業詳細數據。 如果未提供 (預設值),則會擷取與最近或目前作業相關的詳細數據。
資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
目標資料庫的名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
以秒為單位的等候上限。
| 屬性 | 值 |
|---|---|
| 參數群組: | Wait Condition Arguments |
| 預設值: | 3600 |
等到 provisioningState 更新為 'Succeeded'。
| 屬性 | 值 |
|---|---|
| 參數群組: | Wait Condition Arguments |
| 預設值: | False |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |