天天看點

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)

是以,字段是否為空值,在釋出和訂閱的表中應該保持一緻。