Share via


az datamigration sql-managed-instance

注意

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

管理資料庫移轉至SQL 受管理執行個體。

命令

名稱 Description 類型 狀態
az datamigration sql-managed-instance cancel

停止進行中的資料庫移轉至SQL 受管理執行個體。

擴充 GA
az datamigration sql-managed-instance create

建立新的資料庫移轉至指定的SQL 受管理執行個體。

擴充 GA
az datamigration sql-managed-instance cutover

起始進行中線上資料庫移轉至SQL 受管理執行個體的完全移轉。

擴充 GA
az datamigration sql-managed-instance show

擷取指定SQL 受管理執行個體的指定資料庫移轉。

擴充 GA
az datamigration sql-managed-instance wait

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

擴充 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"

必要參數

--migration-operation-id

識別碼追蹤移轉作業。

選擇性參數

--ids

一或多個資源識別碼 (以空格分隔)。 它應該是包含 「資源識別碼」引數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」引數。

--managed-instance-name

目標SQL 受管理執行個體的名稱。

--no-wait

請勿等候長時間執行的作業完成。

預設值: False
--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--subscription

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

--target-db-name

目標資料庫的名稱。

全域參數
--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-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"

必要參數

--managed-instance-name

目標SQL 受管理執行個體的名稱。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--target-db-name

目標資料庫的名稱。

選擇性參數

--migration-service

移轉服務的資源識別碼。

--no-wait

請勿等候長時間執行的作業完成。

預設值: False
--offline-configuration

離線設定。

使用方式:--offline-configuration offline=XX last-backup-name=XX

離線:離線移轉 last-backup-name:離線移轉的最後備份名稱。 這是從檔案共用移轉的選擇性專案。 如果未提供,服務會根據檔案共用中出現的最新備份檔案來判斷最後一個備份檔案名。

--scope

目標資源的資源識別碼(SQL VM、SQL 受管理執行個體或 SQL DB)。

--source-database-name

源資料庫的名稱。

--source-location

備份的來源位置。 預期值:json-string/json-file/@json-file。

--source-sql-connection

來源 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-db-collation

要用於目標資料庫的資料庫定序。

--target-location

複本備份的目標位置。

使用量:--target-location storage-account-resource-id=XX account-key=XX

storage-account-resource-id:複本備份之儲存體帳戶的資源識別碼。 account-key:儲存體帳戶金鑰。

全域參數
--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-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"

必要參數

--migration-operation-id

識別碼追蹤移轉作業。

選擇性參數

--ids

一或多個資源識別碼 (以空格分隔)。 它應該是包含 「資源識別碼」引數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」引數。

--managed-instance-name

目標SQL 受管理執行個體的名稱。

--no-wait

請勿等候長時間執行的作業完成。

預設值: False
--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--subscription

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

--target-db-name

目標資料庫的名稱。

全域參數
--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-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"

選擇性參數

--expand

回應中會包含完整的移轉詳細資料。

--ids

一或多個資源識別碼 (以空格分隔)。 它應該是包含 「資源識別碼」引數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」引數。

--managed-instance-name

目標SQL 受管理執行個體的名稱。

--migration-operation-id

選擇性移轉作業識別碼。 如果提供,則會擷取該識別碼的移轉作業詳細資料。 如果未提供 (預設值),則會擷取與最近或目前作業相關的詳細資料。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--subscription

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

--target-db-name

目標資料庫的名稱。

全域參數
--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-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

選擇性參數

--created

請等候在 'Succeeded' 使用 'provisioningState' 建立。

預設值: False
--custom

等到條件符合自訂 JMESPath 查詢為止。 例如 provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running']。

--deleted

等到刪除為止。

預設值: False
--exists

等候資源存在。

預設值: False
--expand

回應中會包含完整的移轉詳細資料。

--ids

一或多個資源識別碼 (以空格分隔)。 它應該是包含 「資源識別碼」引數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」引數。

--interval

輪詢間隔以秒為單位。

預設值: 30
--managed-instance-name

目標SQL 受管理執行個體的名稱。

--migration-operation-id

選擇性移轉作業識別碼。 如果提供,則會擷取該識別碼的移轉作業詳細資料。 如果未提供 (預設值),則會擷取與最近或目前作業相關的詳細資料。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--subscription

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

--target-db-name

目標資料庫的名稱。

--timeout

以秒為單位的等候上限。

預設值: 3600
--updated

等到 provisioningState 更新為 'Succeeded'。

預設值: 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 來取得完整偵錯記錄。