Thursday, November 18, 2021

LOB size in SQL DB

Exception: System.Data.SqlClient.SqlException: Length of LOB data () to be replicated exceeds configured maximum 65536. Use the stored procedure sp_configure to increase the configured maximum value for max text repl size option, which defaults to 65536. A configured value of -1 indicates no limit, other that the limit imposed by the data type. 

 

When a field in the SQL DB is tracked by CDC. You may encounter this error for Varbinary(max) field. The reason being the default size for replication is maximum 65536. Therefore, if you are in a context where your Varbinary fields are being tracked by CDC for some reason - You will need to configure a higher value for the replication size.

EXEC sp_configure 'max text repl size (B)', -1 RECONFIGURE WITH OVERRIDE

 

-1 indicates that there is no limit or instead of -1 you can set limits in Bytes

No comments: