az datamigration
Note
This reference is part of the datamigration extension for the Azure CLI (version 2.15.0 or higher). The extension will automatically install the first time you run an az datamigration command. Learn more about extensions.
管理数据迁移。
命令
名称 | 说明 | 类型 | Status |
---|---|---|---|
az datamigration get-assessment |
在 SQL Server 实例上启动评估。 |
Extension | GA |
az datamigration get-sku-recommendation |
为 Azure SQL 产品/服务提供 SKU 建议。 |
Extension | GA |
az datamigration login-migration |
将登录名从源 Sql Server 迁移到目标 Azure Sql Server。 |
Extension | GA |
az datamigration performance-data-collection |
收集给定 SQL Server 实例的性能数据。 |
Extension | GA |
az datamigration register-integration-runtime |
在 Integration Runtime 上注册数据库迁移服务。 |
Extension | GA |
az datamigration sql-db |
管理到 SQL DB 的数据库迁移。 |
Extension | GA |
az datamigration sql-db cancel |
停止将数据库迁移到 SQL DB。 |
Extension | GA |
az datamigration sql-db create |
创建新的数据库迁移到给定的 SQL 数据库。 此命令可将所选源数据库表中的数据迁移到目标数据库表。 如果目标数据库没有表,请使用 New-AzDataMigrationSqlServerSchema 命令将架构对象从源数据库迁移到目标 databse。 New-AzDataMigrationSqlServerSchema 的链接是 https://learn.microsoft.com/cli/azure/datamigration?view=azure-cli-latest#az-datamigration-sql-server-schema。 |
Extension | GA |
az datamigration sql-db delete |
删除正在进行的或已完成的数据库迁移到 SQL DB。 |
Extension | GA |
az datamigration sql-db show |
检索给定 SQL DB 的指定数据库迁移。 |
Extension | GA |
az datamigration sql-db wait |
将 CLI 置于等待状态,直到满足数据迁移 sql-db 的条件。 |
Extension | GA |
az datamigration sql-managed-instance |
管理到 SQL 托管实例的数据库迁移。 |
Extension | GA |
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 show |
检索给定 SQL 托管实例的指定数据库迁移。 |
Extension | GA |
az datamigration sql-managed-instance wait |
将 CLI 置于等待状态,直到满足 sql-managed-instance 的数据迁移条件。 |
Extension | GA |
az datamigration sql-server-schema |
将架构从源 Sql Server 迁移到目标 Azure Sql Server。 |
Extension | GA |
az datamigration sql-service |
管理数据库迁移服务。 |
Extension | GA |
az datamigration sql-service create |
创建数据库迁移服务。 |
Extension | GA |
az datamigration sql-service delete |
删除数据库迁移服务。 |
Extension | GA |
az datamigration sql-service delete-node |
删除集成运行时节点。 |
Extension | GA |
az datamigration sql-service list |
检索资源组中的所有数据库迁移服务。 然后检索订阅中的所有数据库迁移服务。 |
Extension | GA |
az datamigration sql-service list-auth-key |
检索自承载集成运行时的身份验证密钥列表。 |
Extension | GA |
az datamigration sql-service list-integration-runtime-metric |
检索已注册的集成 Runtine 节点及其给定数据库迁移服务的监视数据。 |
Extension | GA |
az datamigration sql-service list-migration |
检索附加到服务的数据库迁移列表。 |
Extension | GA |
az datamigration sql-service regenerate-auth-key |
为自承载集成运行时重新生成一组新的身份验证密钥。 |
Extension | GA |
az datamigration sql-service show |
检索数据库迁移服务。 |
Extension | GA |
az datamigration sql-service update |
更新数据库迁移服务。 |
Extension | GA |
az datamigration sql-service wait |
将 CLI 置于等待状态,直到满足数据迁移 sql-service 的条件。 |
Extension | GA |
az datamigration sql-vm |
管理到 SQL VM 的数据库迁移。 |
Extension | GA |
az datamigration sql-vm cancel |
停止将数据库迁移到 SQL VM。 |
Extension | GA |
az datamigration sql-vm create |
创建新的数据库迁移到给定的 SQL VM。 |
Extension | GA |
az datamigration sql-vm cutover |
启动直接转换,以便将正在进行的联机数据库迁移到 SQL VM。 |
Extension | GA |
az datamigration sql-vm show |
检索给定 SQL VM 的指定数据库迁移。 |
Extension | GA |
az datamigration sql-vm wait |
将 CLI 置于等待状态,直到满足数据迁移 sql-vm 的条件。 |
Extension | GA |
az datamigration tde-migration |
将 TDE 证书从源 SQL Server 迁移到目标 Azure SQL Server。 |
Extension | GA |
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
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
ConfigFile 的路径。
SQL Server 连接字符串。
用于存储评估报告的输出文件夹。
启用此参数以覆盖现有评估报告。
属性 | 值 |
---|---|
默认值: | False |
全局参数
提高日志记录详细程度以显示所有调试日志。
属性 | 值 |
---|---|
默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
属性 | 值 |
---|---|
默认值: | False |
Output format.
属性 | 值 |
---|---|
默认值: | json |
接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
属性 | 值 |
---|---|
默认值: | False |
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"
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
ConfigFile 的路径。
允许在排除所有其他数据库时考虑 SKU 建议考虑的数据库名称的空格分隔列表。 仅设置以下项之一或两者:databaseAllowList、databaseDenyList。 Default: null.
不考虑 SKU 建议的数据库名称的空格分隔列表。 仅设置以下项之一或两者:databaseAllowList、databaseDenyList。 Default: null.
是否将 SKU 建议结果打印到控制台。 启用此参数以显示结果。
属性 | 值 |
---|---|
默认值: | False |
是否根据资源使用情况分析使用 SKU 建议的弹性策略。 启用此参数以使用弹性策略。
属性 | 值 |
---|---|
默认值: | False |
聚合期间要考虑的性能数据的 UTC 结束时间,采用 YYYY-MM-DD HH:MM 格式。 仅用于基线(非弹性)策略。 默认值:将考虑收集的所有数据点。
存储 SQL Server 性能数据的输出文件夹。 此处的值必须与 PerfDataCollection 中使用的值相同。
是否覆盖任何现有的 SKU 建议报告。 启用此参数以覆盖。
属性 | 值 |
---|---|
默认值: | False |
在 SKU 建议期间使用的缩放(舒适)因子。 例如,如果确定有 4 个 vCore CPU 要求,缩放系数为 150%,则真正的 CPU 要求将为 6 个 vCore。
属性 | 值 |
---|---|
默认值: | 100 |
聚合期间要考虑的性能数据点的 UTC 开始时间,采用 YYYY-MM-DD HH:MM 格式。 仅用于基线(非弹性)策略。 默认值:将考虑收集的所有数据点。
性能数据聚合期间要使用的数据点百分位数。 仅用于基线(非弹性)策略。
属性 | 值 |
---|---|
默认值: | 95 |
SKU 建议的目标平台:AzureSqlDatabase、AzureSqlManagedInstance、AzureSqlVirtualMachine 或 Any。 如果选择了“任何”,则会评估所有三个目标平台的 SKU 建议,并返回最佳拟合度。
属性 | 值 |
---|---|
默认值: | Any |
应为其推荐 SKU 的 SQL 实例的名称。 默认值:将扫描 outputFolder 以获取 PerfDataCollection 操作创建的文件,并为找到的每个实例提供建议。
全局参数
提高日志记录详细程度以显示所有调试日志。
属性 | 值 |
---|---|
默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
属性 | 值 |
---|---|
默认值: | False |
Output format.
属性 | 值 |
---|---|
默认值: | json |
接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
属性 | 值 |
---|---|
默认值: | False |
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"
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
如果要迁移的登录名列表中包括 Windows 登录名,则为必需。
ConfigFile 的路径。
登录名的 CSV 文件的位置。 在此参数和 listOfLogin 之间只使用一个参数。
字符串格式的登录名列表。 如果需要迁移大量登录名,请使用 CSV 文件选项。
默认值:%LocalAppData%/Microsoft/SqlLoginMigrations) 将写入日志的文件夹。
源 SQL 实例的连接字符串(s),使用正式连接字符串格式。
目标 SQL 实例的连接字符串(s),使用正式连接字符串格式。
全局参数
提高日志记录详细程度以显示所有调试日志。
属性 | 值 |
---|---|
默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
属性 | 值 |
---|---|
默认值: | False |
Output format.
属性 | 值 |
---|---|
默认值: | json |
接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
属性 | 值 |
---|---|
默认值: | False |
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
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
ConfigFile 的路径。
SQL Server 连接字符串。
在保存到文件之前要执行的性能数据收集的迭代次数。 例如,对于默认值,性能数据每 30 秒保留一次 * 20 次迭代 = 10 分钟。 Minimum: 2.
属性 | 值 |
---|---|
默认值: | 20 |
用于存储性能数据的输出文件夹。
查询性能数据的间隔(以秒为单位)。
属性 | 值 |
---|---|
默认值: | 30 |
查询和保存静态配置数据的间隔(以秒为单位)。
属性 | 值 |
---|---|
默认值: | 3600 |
命令执行自动停止的时间(以秒为单位)。 如果未指定此参数,则需要手动干预才能停止命令执行。
全局参数
提高日志记录详细程度以显示所有调试日志。
属性 | 值 |
---|---|
默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
属性 | 值 |
---|---|
默认值: | False |
Output format.
属性 | 值 |
---|---|
默认值: | json |
接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
属性 | 值 |
---|---|
默认值: | False |
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。
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Integration Runtime 安装位置中的版本文件夹路径。 安装 IR 时,可以提供此功能,但命令无法读取它。 格式:<Parent-folder-path>\Microsoft Integration Runtime\<Version>
。
Integration Runtime MSI 的路径。
全局参数
提高日志记录详细程度以显示所有调试日志。
属性 | 值 |
---|---|
默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
属性 | 值 |
---|---|
默认值: | False |
Output format.
属性 | 值 |
---|---|
默认值: | json |
接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
属性 | 值 |
---|---|
默认值: | False |
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 数据库。
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 数据库。
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 数据库。
az datamigration sql-server-schema --config-file-path "C:\configfile.json"
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
选择一个架构迁移作。 MigrateSchema 将数据库对象迁移到 Azure SQL 数据库目标。 GenerateScript 用于生成可编辑的 TSQL 架构脚本,该脚本可用于在目标上运行以部署对象。 DeploySchema 是运行从目标上 -GenerateScript作生成的 TSQL 脚本来部署对象。
属性 | 值 |
---|---|
接受的值: | DeploySchema, GenerateScript, MigrateSchema |
ConfigFile 的路径。 configfile.json 中接受的参数名称为 Action、sourceConnectionString、targetConnectionString、inputScriptFilePath 和 outputFolder。
可编辑 TSQL 架构脚本的位置。 仅对 DeploySchema Action 使用此参数。
默认值:%LocalAppData%/Microsoft/SqlSchemaMigration) 文件夹,其中日志将由 GenerateScript 操作写入和生成的 TSQL 架构脚本。
源 SQL 实例的连接字符串,使用正式的连接字符串格式。
目标 SQL 实例的连接字符串,使用正式连接字符串格式。
全局参数
提高日志记录详细程度以显示所有调试日志。
属性 | 值 |
---|---|
默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
属性 | 值 |
---|---|
默认值: | False |
Output format.
属性 | 值 |
---|---|
默认值: | json |
接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
属性 | 值 |
---|---|
默认值: | False |
az datamigration tde-migration
将 TDE 证书从源 SQL Server 迁移到目标 Azure SQL Server。
az datamigration tde-migration [--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]
[--target-managed-instance-name --tgtname]
[--target-resource-group-name --tgtrg]
[--target-subscription-id --tgtsubscription]
示例
将 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"
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
源数据库名称。
网络共享域。
网络共享密码。
网络共享路径。
网络共享用户名。
源 SQL 实例的连接字符串,使用正式的连接字符串格式。
Azure SQL Server 的名称。
目标 Azure SQL Server 的资源组名称。
目标 Azure SQL Server 的订阅 ID。
全局参数
提高日志记录详细程度以显示所有调试日志。
属性 | 值 |
---|---|
默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
属性 | 值 |
---|---|
默认值: | False |
Output format.
属性 | 值 |
---|---|
默认值: | json |
接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
属性 | 值 |
---|---|
默认值: | False |