排查常见的 Azure 数据库迁移服务问题和错误Troubleshoot common Azure Database Migration Service issues and errors

本文描述了 Azure 数据库迁移服务用户可能遇到的一些常见问题和错误。This article describes some common issues and errors that Azure Database Migration Service users can come across. 本文还包含有关如何解决这些问题和错误的信息。The article also includes information about how to resolve these issues and errors.

迁移活动处于排队状态Migration activity in queued state

在 Azure 数据库迁移服务项目中创建新活动时,活动保持为排队状态。When you create new activities in an Azure Database Migration Service project, the activities remain in a queued state.

原因Cause 解决方法Resolution
如果 Azure 数据库迁移服务实例达到正在运行的任务的最大容量,则会出现此问题。This issue happens when the Azure Database Migration Service instance has reached maximum capacity for ongoing tasks that concurrently run. 任何新活动将排队到容量可用为止。Any new activity is queued until the capacity becomes available. 验证数据迁移服务实例是否在运行各个项目中的活动。Validate the Data Migration Service instance has running activities across projects. 可以继续创建新活动,这些活动会自动添加到队列中等待执行。You can continue to create new activities that automatically get added to the queue for execution. 任何一个正在运行的现有活动完成后,下一个排队的活动会立即开始运行,其状态会自动更改为正在运行。As soon as any of the existing running activities complete, the next queued activity starts running and the status changes to running state automatically. 无需采取任何额外的措施即可开始迁移排队的活动。You don't need to take any additional action to start migration of queued activity.

选择迁移的数据库数目上限Max number of databases selected for migration

为要转移到 Azure SQL 数据库或 Azure SQL 托管实例的数据库迁移项目创建活动时发生以下错误:The following error occurs when creating an activity for a database migration project for moving to Azure SQL Database or an Azure SQL Managed Instance:

  • 错误:迁移设置验证错误: "errorDetail": 选择迁移的“数据库”对象数目超过最大数目 '4'。Error: Migration settings validation error", "errorDetail":"More than max number '4' objects of 'Databases' has been selected for migration."
原因Cause 解决方法Resolution
如果为单个迁移活动选择的数据库数目超过 4 个,则会显示此错误。This error displays when you've selected more than four databases for a single migration activity. 目前,每个迁移活动限制为 4 个数据库。At present, each migration activity is limited to four databases. 为每个迁移活动选择 4 个或更少的数据库。Select four or fewer databases per migration activity. 如果需要同时迁移 4 个以上数据库,请预配 Azure 数据库迁移服务的另一个实例。If you need to migrate more than four databases in parallel, provision another instance of Azure Database Migration Service. 目前,每个订阅最多支持两个 Azure 数据库迁移服务实例。Currently, each subscription supports up to two Azure Database Migration Service instances.

从 MySQL 迁移到 Azure MySQL 出错并发生恢复失败Errors for MySQL migration to Azure MySQL with recovery failures

使用 Azure 数据库迁移服务从 MySQL 迁移到 Azure Database for MySQL 时,迁移活动失败并出现以下错误:When you migrate from MySQL to Azure Database for MySQL using Azure Database Migration Service, the migration activity fails with the following error:

  • 错误:数据库迁移错误 - 由于 [n] 次连续恢复失败,任务 'TaskID' 已挂起。Error: Database migration error - Task 'TaskID' was suspended due to [n] successive recovery failures.
原因Cause 解决方法Resolution
当执行迁移的用户缺少 ReplicationAdmin 角色和/或 REPLICATION CLIENT、REPLICATION REPLICA 和 SUPER(低于 MySQL 5.6.6 的版本)的特权时,可能会发生此错误。This error may occur when the user doing the migration is missing ReplicationAdmin role and/or privileges of REPLICATION CLIENT, REPLICATION REPLICA, and SUPER (versions earlier than MySQL 5.6.6).












确保在 Azure Database for MySQL 实例中为用户帐户准确配置必备特权Make sure the pre-requisite privileges for the user account are configured accurately on the Azure Database for MySQL instance. 例如,可以遵循以下步骤创建具有所需特权的名为“migrateuser”的用户:For example, the following steps can be followed to create a user named 'migrateuser' with required privileges:
1.CREATE USER migrateuser@'%' IDENTIFIED BY 'secret';1. CREATE USER migrateuser@'%' IDENTIFIED BY 'secret';
2.将针对 db_name.* 的所有特权授予 'secret' 'migrateuser'@'%';// 重复此步骤以授予针对其他数据库的访问权限2. Grant all privileges on db_name.* to 'migrateuser'@'%' identified by 'secret'; // repeat this step to grant access on more databases
3.将针对 . 的 replication slave 权限授予3. Grant replication slave on . 'secret' 标识的 'migrateuser'@'%';to 'migrateuser'@'%' identified by 'secret';
4.将针对 . 的 replication client 权限授予4. Grant replication client on . 'secret' 标识的 'migrateuser'@'%';to 'migrateuser'@'%' identified by 'secret';
5.刷新特权;5. Flush privileges;

尝试停止 Azure 数据库迁移服务时出错Error when attempting to stop Azure Database Migration Service

停止 Azure 数据库迁移服务实例时收到以下错误:You receive following error when stopping the Azure Database Migration Service instance:

  • 错误:服务无法停止。Error: Service failed to Stop. 错误: {'error':{'code':'InvalidRequest','message': '一个或多个活动当前正在运行。Error: {'error':{'code':'InvalidRequest','message':'One or more activities are currently running. 若要停止服务,请等到这些活动完成,或手动停止这些活动,然后重试。'}}To stop the service, wait until the activities have completed or stop those activities manually and try again.'}}
原因Cause 解决方法Resolution
如果尝试停止的服务实例包含仍在运行的或者存在于迁移项目中的活动,则会显示此错误。This error displays when the service instance you're attempting to stop includes activities that are still running or present in migration projects.





确保尝试停止的 Azure 数据库迁移服务实例中没有任何活动正在运行。Ensure that there are no activities running in the instance of Azure Database Migration Service you're trying to stop. 在尝试停止该服务之前,还可以删除活动或项目。You may also delete the activities or projects before attempting to stop the service. 以下步骤演示如何通过删除所有正在运行的任务来删除项目,以清理迁移服务实例:The following steps illustrate how to remove projects to clean up the migration service instance by deleting all running tasks:
1.Install-Module -Name AzureRM.DataMigration1. Install-Module -Name AzureRM.DataMigration
2.Login-AzureRmAccount -EnvironmentName AzureChinaCloud2. Login-AzureRmAccount -EnvironmentName AzureChinaCloud
3.Select-AzureRmSubscription -SubscriptionName "<subName>"3. Select-AzureRmSubscription -SubscriptionName "<subName>"
4.Remove-AzureRmDataMigrationProject -Name <projectName> -ResourceGroupName <rgName> -ServiceName <serviceName> -DeleteRunningTask4. Remove-AzureRmDataMigrationProject -Name <projectName> -ResourceGroupName <rgName> -ServiceName <serviceName> -DeleteRunningTask

尝试启动 Azure 数据库迁移服务时出错Error when attempting to start Azure Database Migration Service

启动 Azure 数据库迁移服务实例时收到以下错误:You receive following error when starting the Azure Database Migration Service instance:

  • 错误:服务无法启动。Error: Service fails to Start. 错误: {'errorDetail':'服务无法启动,请联系 Azure 支持部门'}Error: {'errorDetail':'The service failed to start, please contact Azure support'}
原因Cause 解决方法Resolution
上一实例发生内部故障时,会显示此错误。This error displays when the previous instance failed internally. 此错误极少发生,工程团队已了解这一情况。This error occurs rarely, and the engineering team is aware of it.
请删除无法启动的服务的实例,然后预配一个新的来代替它。Delete the instance of the service that you cannot start, and then provision new one to replace it.

在将 SQL 迁移到 Azure SQL DB 托管实例的过程中还原数据库时出错Error restoring database while migrating SQL to Azure SQL DB managed instance

从 SQL Server 联机迁移到 Azure SQL 托管实例时,直接转换失败,出现以下错误:When you perform an online migration from SQL Server to Azure SQL Managed Instance, the cutover fails with following error:

  • 错误:操作 ID 为“operationId”的还原操作失败。Error: Restore Operation failed for operation Id 'operationId'. 代码为“AuthorizationFailed”,消息为“对象 ID 为 'objectId' 的客户端 'clientId' 无权执行作用域为 '/订阅/subscriptionId' 的操作 'Microsoft.Sql/locations/managedDatabaseRestoreAzureAsyncOperation/read'。”。Code 'AuthorizationFailed', Message 'The client 'clientId' with object id 'objectId' does not have authorization to perform action 'Microsoft.Sql/locations/managedDatabaseRestoreAzureAsyncOperation/read' over scope '/subscriptions/subscriptionId'.'.
原因Cause 解决方法Resolution
此错误表明,用于从 SQL Server 联机迁移到 SQL 托管实例的应用程序主体在订阅上没有参与权限。This error indicates the application principal being used for online migration from SQL Server to SQL Managed Instance doesn't have contribute permission on the subscription. 目前,使用托管实例进行的某些 API 调用需要在订阅上有此权限才能执行还原操作。Certain API calls with Managed Instance at present require this permission on subscription for the restore operation.













Get-AzureADServicePrincipal PowerShell cmdlet 与错误消息中提供的 -ObjectId 配合使用即可列出所用应用程序 ID 的显示名称。Use the Get-AzureADServicePrincipal PowerShell cmdlet with -ObjectId available from the error message to list the display name of the application ID being used.

验证此应用程序的权限,确保其在订阅级别有参与者角色Validate the permissions to this application and ensure it has the contributor role at the subscription level.

Azure 数据库迁移服务工程团队会限定从订阅上的当前参与角色进行访问这一必需权限。The Azure Database Migration Service Engineering Team is working to restrict the required access from current contribute role on subscription. 如果你的业务要求不允许使用参与角色,请联系 Azure 支持部门以获取更多帮助。If you have a business requirement that doesn't allow use of contribute role, contact Azure support for additional help.

删除与 Azure 数据库迁移服务关联的 NIC 时出错Error when deleting NIC associated with Azure Database Migration Service

尝试删除与 Azure 数据库迁移服务关联的网络接口卡时,该操作失败并出现以下错误:When you try to delete a Network Interface Card associated with Azure Database Migration Service, the deletion attempt fails with this error:

  • 错误:无法删除与 Azure 数据库迁移服务关联的 NIC,因为 DMS 服务正在使用该 NICError: Cannot delete the NIC associated to Azure Database Migration Service due to the DMS service utilizing the NIC
原因Cause 解决方法Resolution
如果 Azure 数据库迁移服务实例仍然存在并在使用该 NIC,则会出现此问题。This issue happens when the Azure Database Migration Service instance may still be present and consuming the NIC.







若要删除此 NIC,请删除 DMS 服务实例,这会自动删除该服务使用的 NIC。To delete this NIC, delete the DMS service instance that automatically deletes the NIC used by the service.

重要说明:确保要删除的 Azure 数据库迁移服务实例中没有任何正在运行的活动。Important: Make sure the Azure Database Migration Service instance being deleted has no running activities.

删除与 Azure 数据库迁移服务实例关联的所有项目和活动后,可以删除服务实例。After all the projects and activities associated to the Azure Database Migration Service instance are deleted, you can delete the service instance. 在删除服务的过程中,会自动清理服务实例使用的 NIC。The NIC used by the service instance is automatically cleaned as part of service deletion.

使用 ExpressRoute 时出现连接错误Connection error when using ExpressRoute

尝试在 Azure 数据库迁移服务项目向导中连接到源时,如果源使用 ExpressRoute 进行连接,在长时间的超时后,连接将会失败。When you try to connect to source in the Azure Database Migration service project wizard, the connection fails after prolonged timeout if source is using ExpressRoute for connectivity.

原因Cause 解决方法Resolution
使用 ExpressRoute 时,Azure 数据库迁移服务要求在与它关联的虚拟网络子网中预配三个服务终结点:When using ExpressRoute, Azure Database Migration Service requires provisioning three service endpoints on the Virtual Network subnet associated with the service:
-- 服务总线终结点-- Service Bus endpoint
-- 存储终结点-- Storage endpoint
-- 目标数据库终结点(例如 SQL 终结点、Cosmos DB 终结点)-- Target database endpoint (e.g. SQL endpoint, Cosmos DB endpoint)




启用所需的服务终结点,以便在源与 Azure 数据库迁移服务之间建立 ExpressRoute 连接。Enable the required service endpoints for ExpressRoute connectivity between source and Azure Database Migration Service.







将 MySQL 数据库迁移到 Azure DB for MySQL 时发生锁定等待超时错误Lock wait timeout error when migrating a MySQL database to Azure DB for MySQL

通过 Azure 数据库迁移服务将 MySQL 数据库迁移到 Azure Database for MySQL 实例时,迁移失败并出现以下锁定等待超时错误:When you migrate a MySQL database to an Azure Database for MySQL instance via Azure Database Migration Service, the migration fails with following lock wait timeout error:

  • 错误:数据库迁移错误 - 无法加载文件 - 无法针对文件 'n' RetCode 启动加载进程:SQL_ERROR SqlState:HY000 NativeError:1205 消息: [MySQL][ODBC Driver][mysqld] 锁定等待超时;请尝试重启事务Error: Database migration error - Failed to load file - Failed to start load process for file 'n' RetCode: SQL_ERROR SqlState: HY000 NativeError: 1205 Message: [MySQL][ODBC Driver][mysqld] Lock wait timeout exceeded; try restarting transaction
原因Cause 解决方法Resolution
之所以在迁移失败时发生此错误,是因为迁移期间发生锁定等待超时。This error occurs when migration fails because of the lock wait timeout during migration. 考虑增大服务器参数 'innodb_lock_wait_timeout' 的值。Consider increasing the value of server parameter 'innodb_lock_wait_timeout'. 允许的最大值为 1073741824。The highest allowed value is 1073741824.

使用动态端口或命名实例连接到源 SQL Server 时出错Error connecting to source SQL Server when using dynamic port or named instance

尝试将 Azure 数据库迁移服务连接到在命名实例或动态端口上运行的 SQL Server 源时,连接失败并出现以下错误:When you try to connect Azure Database Migration Service to SQL Server source that runs on either named instance or a dynamic port, the connection fails with this error:

  • 错误:-1 - SQL 连接失败。Error: -1 - SQL connection failed. 建立与 SQL Server 的连接时,出现网络相关或特定于实例的错误。A network-related or instance-specific error occurred while establishing a connection to SQL Server. 找不到或无法访问服务器。The server was not found or was not accessible. 验证实例名称是否正确,以及 SQL Server 是否已配置为允许远程连接。Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (提供程序:SQL 网络接口,错误:26 - 查找指定的服务器/实例时出错)(provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
原因Cause 解决方法Resolution
当 Azure 数据库迁移服务尝试连接到的源 SQL Server 实例有一个动态端口或者使用命名实例时,会发生此问题。This issue happens when the source SQL Server instance that Azure Database Migration Service tries to connect to either has a dynamic port or is using a named instance. 通过传入连接连接到命名实例或者使用动态端口时,SQL Server 浏览器服务会侦听 UDP 端口 1434。The SQL Server Browser service listens to UDP port 1434 for incoming connections to a named instance or when using a dynamic port. 每次 SQL Server 服务重启时,动态端口可能会更改。The dynamic port may change each time SQL Server service restarts. 可以通过 SQL Server 配置管理器中的网络配置检查分配给实例的动态端口。You can check the dynamic port assigned to an instance via network configuration in SQL Server Configuration Manager.


验证 Azure 数据库迁移服务能否在适用情况下通过动态分配的 TCP 端口连接到 UDP 端口 1434 上的 SQL Server 浏览器服务和 SQL Server 实例。Verify that Azure Database Migration Service can connect to the source SQL Server Browser service on UDP port 1434 and the SQL Server instance through the dynamically assigned TCP port as applicable.

其他已知问题Additional known issues

后续步骤Next steps