Symptoms

Assume that you use merge replication that the Publisher is running on Microsoft SQL Server 2012 or SQL Server 2012 Service Pack 1 (SP1). After you upgrade the Publisher to SQL Server 2012 Service Pack 2 (SP2), you cannot restart the Merge Agent. Additionally, you receive the following error:

The merge process could not perform retention-based metadata cleanup in database 'MergePub'. If this failure continues, try increasing the query timeout for this process, or try reducing the retention period. When troubleshooting, restart the synchronization with verbose history logging and specify an output file to which to write.

When you execute the sp_mergemetadataretentioncleanup stored procedure manually on the Publisher, the stored procedure fails and you receive the following error:

Msg 206, Level 16, State 2, Procedure sp_mergemetadataretentioncleanup, Line 63
Operand type clash: bigint is incompatible with uniqueidentifier
Msg 206, Level 16, State 2, Procedure sp_mergemetadataretentioncleanup, Line 65
Operand type clash: int is incompatible with uniqueidentifier

Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:


Workaround

To work around this issue, execute the following query on the published database:if exists (select * from sys.columns sc inner join sys.types st on sc.system_type_id = st.system_type_id
where object_id = object_id('dbo.sysmergesubscriptions')
and sc.name = 'last_local_recgen' and st.name = 'uniqueidentifier')
begin
alter table dbo.sysmergesubscriptions drop column last_local_recgen
alter table dbo.sysmergesubscriptions add last_local_recgen bigint null
end

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

What affected your experience?

Thank you for your feedback!

×