MySql 5.6 到 MSSql server 2014 迁移:ExecuteReader 需要一个打开且可用的连接

2022-01-23 00:00:00 migration mysql sql-server

MySql: 5.6MSSql: 2014使用的工具: MySql 的 SSMA

MySql: 5.6 MSSql: 2014 Tools Used: SSMA for MySql

从 mysql 迁移到 mssql 时,表和视图的所有结构都已成功迁移.迁移数据时,数据被部分移动,出现以下错误.

While migrating from mysql to mssql, all the structures for tables and views were migrated successfully. While migrating data, data was moved partially and I got the following errors.

ExecuteReader requires an open and available Connection. The connection's current state is closed.; SQL Server cannot access the source table <table-name>

The connection has been disabled.

还有其他一些琐碎的问题,例如Column 'modified_on' does not allow DBNull.Value.",我通过编辑表结构手动修复了这些问题.

There were other trivial issues as well like "Column 'modified_on' does not allow DBNull.Value." which I have fixed manually by editing the table structure.

推荐答案

为了解决 Column 'modified_on' 不允许 DBNull.Value 问题,SQL Server management studio 不允许我编辑结构.为此,我必须按如下方式更改配置.

To Fix the Column 'modified_on' does not allow DBNull.Value issue, SQL Server management studio doesn't allow me to edit the structure. For that I had to change the configuration as follows.

打开 SQL Server 管理工作室 -> 转到工具 -> 选项 ->设计师并取消选中防止保存需要表格的更改再创造."

Open SQL Server management studio -> Goto Tools -> Options -> Designers and uncheck "Prevent saving changes that require table re-creation."

修复以下两个问题:

ExecuteReader requires an open and available Connection. The connection's current state is closed.; SQL Server cannot access the source table <table-name>

The connection has been disabled.

解决方案:

为 MySql 打开 SSMA -> 转到工具 -> 项目设置 -> 选择左侧菜单中的常规 -> 选择迁移 -> 在 Misc 部分中-> 以分钟为单位设置数据迁移超时 = 500

Open SSMA for MySql -> Goto Tools -> Project Settings -> Select General from the left menu -> Select Migration -> In the Misc section -> set data migration timeout in minutes = 500

为 MySql 打开 SSMA -> 转到工具 -> 项目设置 -> 选择左侧菜单中的常规 -> 选择迁移 -> 在并行数据迁移部分-> 将 并行数据迁移模式 从 Auto 设置为 Custom 并将 Thread Count 从 10 设置为 5

Open SSMA for MySql -> Goto Tools -> Project Settings -> Select General from the left menu -> Select Migration -> In the Parallel data migration section -> set Parallel data migration mode from Auto to Custom and set Thread Count from 10 to 5

再次运行数据迁移.

希望对你有帮助.

相关文章