• This error occurs due to two causes:

    1. The last LSN in Transaction Log is less than what the LSN Log Reader is trying to find. An old backup may have been restored on top of Published Database. After the restore, the new Transaction Log doesn't contain the data now distributor & subscriber(s) have.

    2. Database corruption.

    You should follow these steps to fix the error:

    1. Ensure database consistency by running DBCC CHECKDB on the database.

    2. If an old backup was restored on top of published database then use sp_replrestart

    If going back to the most recent transaction log backup is not an option then execute sp_replrestart on publisher in published database. This stored procedure is used when the highest log sequence number (LSN) value at the Distributor does match the highest LSN value at the Publisher.

    This stored procedure will insert compensating LSNs (No Operation) in the publisher database log file till one the compensating LSN becomes more than the highest distributed LSN in distribution database for this published database. After this it inserts this new high LSN in the msrepl_transactions table in the distribution database and executes sp_repldone on published database to update the internal structures to mark a new starting point for log reader agent.

    Ensure that the log reader agent is stopped and there is no incoming transactions on the published database, when this SP is executed.

    3. Since transactions may have been lost, we recommend to reinitialize the subscriber(s) and/or recreate publication/subscription(s). For large databases consider using “Initialize from Backup” as discussed in SQL Book Online.

    Ref: http://blogs.msdn.com/b/repltalk/archive/2010/02/19/the-process-could-not-execute-sp-repldone-sp-replcounters.aspx

    SQL Database Recovery Expert 🙂