天天看点

SQLServer 进程无法向表进行大容量复制(错误号: 22018 20253)

我的环境:SQL SERVER 2008 R2:发布者 ->SQL SERVER 2017 订阅者

进程无法向表“"dbo"."XXXXX"”进行大容量复制。 (源: MSSQL_REPL,错误号: MSSQL_REPL20037)

获取帮助: http://help/MSSQL_REPL20037

元数据查询失败

对于造型说明无效的字符值 (源: MSSQLServer,错误号: 22018)

获取帮助: http://help/22018

未指定的错误

Error messages: The process could not bulk copy into table '"dbo"."Cars"'. (Source: MSSQL_REPL, Error number: MSSQL_REPL20037) Get help: http://help/MSSQL_REPL20037 metadata query failed Invalid character value for cast specification (Source: MSSQLServer, Error number: 22018) Get help: http://help/22018 Unspecified error

I had exactly the same problem replicating from SQL Server 2008 R2 to SQL Server 2016.

It seems that it is a specific problem with replication from 2008 R2 to 2016. The same replication setup works fine from SQL Server 2012 to SQL Server 2016.

Another workaround I found is to set the compatibility level of the subscriber database to 120 (instead of 130)

I guess that there is a problem with native client 10 and the way it gathers the meta data of the destination table.

兼容性级别改为一致 即可!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

SQLServer 进程无法向表进行大容量复制(错误号: 22018 20253)

 另外: 

 解决方案: 比较数据库建表脚本,发现字段脚本不一致 比如:varchar(256)与varchar(512).改为一致即可。

以下网上摘录作为参考.

模拟出来的问题,这里记录下来吧。

事物复制中,发布的表有一字段允许为null,并且该字段存在null值。而自己在订阅中先创建该表,并且把这个字段该为not null,结果出现了以下的错误。

SQLServer 进程无法向表进行大容量复制(错误号: 22018 20253)

所以,字段是否为空值,在发布和订阅的表中应该保持一致。