I am getting the following errors (from the merge agent job log):
"The Publisher failed to allocate a new set of identity ranges for the subscription. This can occur when a Publisher or a republishing Subscriber has run out of identity ranges to allocate to its own Subscribers or when an identity column data type does not support an additional identity range allocation. If a republishing Subscriber has run out of identity ranges, synchronize the republishing Subscriber to obtain more identity ranges before restarting the synchronization. If a Publisher runs out of identit"
and
"Error converting data type nvarchar to numeric."
I have an alert setup on the replication agent failure, and the email says this... "Replication-Replication Merge Subsystem: agent PubSQL-Customer-tables-mer-SubSQL-2 failed. The Publisher failed to allocate a new set of identity ranges for the subscription. This can occur when a Publisher or a republishing Subscriber has run out of identity ranges to allocate to its own Subscribers or when an identity column data type does no"
I started getting these errors a few days after implementing merge replication, so I removed the articles from the publication. I did start a trace and then start the merge agent so the error would show up, but my trace doesn't show an exception (not sure why). I think I have found the issue in the trace, I see the following command:
declare @p4 smallint set @p4=0 declare @p5 numeric(38,0) set @p5=468269 declare @p6 numeric(38,0) set @p6=473269 declare @p7 numeric(38,0) set @p7=473269 declare @p8 numeric(38,0) set @p8=478269 exec sys.sp_MSallocate_new_identity_range '07576F87-BA91-4863-BFE3-89228285F4A3','B241AAA2-1EAB-4AA5-B702-4966FE0A408E',2,@p4 output,@p5 output,@p6 output,@p7 output,@p8 output,N'tables-merge',N'SubSQL',N'Customer' select @p4, @p5, @p6, @p7, @p8
Then, right after, this is executed:
declare @p4 smallint set @p4=0 declare @p5 nvarchar(40) set @p5=N'468269 ' declare @p6 nvarchar(40) set @p6=N'473269 ' declare @p7 nvarchar(40) set @p7=N'473269 ' declare @p8 nvarchar(40) set @p8=N'478269 ' exec sys.sp_MSallocate_new_identity_range '07576F87-BA91-4863-BFE3-89228285F4A3','B241AAA2-1EAB-4AA5-B702-4966FE0A408E',2,@p4 output,@p5 output,@p6 output,@p7 output,@p8 output,N'tables-merge',N'SubSQL',N'Customer' select @p4, @p5, @p6, @p7, @p8
The parameters to sys.sp_MSallocate_new_identity_range in the second command are not supposed to be sent as nvarchar, which would explain why I am getting the "Error converting data type nvarchar to numeric." message.
Why are these parameters being sent as nvarchar? Is this causing the other error message to be raised?
Here is the script I used to add the article to the publication:
use [Customer] exec sp_addmergearticle @publication = N'tables-merge', @force_reinit_subscription = 1, @column_tracking = N'true', @subset_filterclause = null, @description = null, @creation_script = null, @pre_creation_cmd = N'none', @type = N'table', @vertical_partition = N'false', @verify_resolver_signature = 1, @allow_interactive_resolver = N'false', @fast_multicol_updateproc = N'true', @check_permissions = 0, @subscriber_upload_options = 0, @delete_tracking = N'true', @compensate_for_errors = N'false', @stream_blob_columns = N'false', @partition_options = 0, @force_invalidate_snapshot = 1, @schema_option = 0x000000014C034FD1, @source_owner = N'dbo', @destination_owner = N'dbo', @article = N'dbo.GroupActivity', @source_object = N'GroupActivity', @identityrangemanagementoption = N'auto', @pub_identity_range = 5000, @identity_range = 5000, @threshold = 90 go
How can I fix this?
Any help would be greatly appreciated. Thanks in advance.
Jarret