FIX: Distribution Agent skips applying sp_MSins_, sp_MSupd_, sp_MSdel_ stored procedures on a Subscriber that is initialized with Backup in SQL Server 2012 or SQL Server 2014

Applies to: SQL Server 2012 DeveloperSQL Server 2012 EnterpriseSQL Server 2012 Standard More


When you set up a Transactional replication and Initialize a transactional subscription from a backup in Microsoft SQL Server 2012 or SQL Server 2014. During the initial synchronization, the Distribution Agent fails, and you receive the following errors:

Connecting to Subscriber
No replicated transactions are available.
42000 Could not find stored procedure 'sp_MSins_'. 2812
42000 Could not find stored procedure 'sp_MSins_'. 2812


This issue is caused by a difference in timing between the log reader agent and Distribution Agent initial execution. If there are lot of transactional changes occurring at the publisher there is a delay in log reader agent generating and adding the custom stored procedure scripts into MSRepl_commands in the distribution database. If the Distribution Agent starts and has already made a roundtrip to the distribution database before these commands are added, it will move the transaction time stamp ahead and will report ‘No replicated transactions are available’. Later synchronization attempts by the Distribution Agent cannot detect the custom stored procedure creation commands and will fail with the errors that are mentioned in the "Symptoms" section.


The issue was first fixed in the following cumulative update of SQL Server.

Cumulative Update 1 for SQL Server 2014

Cumulative Update 9 for SQL Server 2012 SP1


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