Log Reader Agent Fails with the Error “The Log Reader Agent failed to construct a replicated command from log sequence number (LSN)”

Recently we encountered a case where in the Log Reader Agent fails to run and the following error is reported in the Replication Monitor

Error messages:
The process could not execute ‘sp_replcmds’ on ‘TXDAL01410’. (Source: MSSQL_REPL, Error number: MSSQL_REPL20011)
Get help: http://help/MSSQL_REPL20011

Execution of filter stored procedure 2048634987 failed. See the SQL Server errorlog for more information. (Source: MSSQLServer, Error number: 18764)
Get help: http://help/18764

The Log Reader Agent failed to construct a replicated command from log sequence number (LSN) {0001d651:00002a49:0006}. Back up the publication database and contact Customer Support Services. (Source: MSSQLServer, Error number: 18805)
Get help: http://help/18805 
The process could not execute ‘sp_replcmds’ on ‘TXDAL01410’. (Source: MSSQL_REPL, Error number: MSSQL_REPL22037)
Get help: http://help/MSSQL_REPL22037


The above Error indicates the Log Reader Agent is stuck at LSN {0001d651:00002a49:0006} and is not able to read and create a command for this LSN.
As the Log Reader Agent is stuck at the LSN, it is not moving ahead and since we can have only 1 Log Reader Agent in Transactional Replication which is used for all the publications. All the publications is showing error in the replication monitor and is not moving ahead. 

We checked the transaction at the LSN {0001d651:00002a49:0006}. 

From the above Error we see “Execution of filter stored procedure 2048634987 failed”
We checked the Filter Stored Procedure ID from sysarticles and found that it was the filter stored procedure for table dbo.booking 
Select * from sysarticles where filter=2048634987
However the entry of the filter stored procedure was missing in the sysobjects tables which indicate that the filter stored procedure was deleted due to some reason. To confirm this we used the following query 

* from (select art.name as article_name

, art.pubid as publication_id

, art.artid as article_id

, art.filter as filter_proc_id

, isnull(obj.name,‘## MISSING!! ##’) as filter_proc_name

from sysarticles art left outer join sys.objects obj

on art.filter = obj.object_id

where art.filter > 0)as results — and obj.name is null (use when only the mismatched articles where required).

where filter_proc_name=‘## MISSING!! ##’


scott                     750          4343        77151966                 ## MISSING!! ##
test                       750          4336        2048634987             ## MISSING!! ##
tiger                      750          4337        2096635158             ## MISSING!! ##

As seen from the above output, we have 3 tables viz scott,test,tiger all belonging to the same publication with the pubid = 750 have their filter stored procedure missing in the sysobjects.


So to resolve this we identified the publications from syspublications table with pubid=750.
We then deleted the filtering for the above 3 articles and re-added them and the stored procedure got recreated.
We then recreated the snapshot for that publication and marked it’s subscriber for re-initialization.
The Snapshot agent recreated the snapshot and Log Reader Agent started running fine without error.
We checked the replication Monitor and the error vanished..

Parikshit Savjani,
SE, Microsoft SQL Server

Reviewed By Anurag Sharma, SQL Server Escalation Services

Comments (7)

  1. Nigel says:


    Wrote wrote: "We checked the transaction at the LSN {0001d651:00002a49:0006}.".  How did you do this?

    We have a similar problem and we don’t know how to get the content of the LSN.


  2. Hi Nigel,

    You dont need to see the transaction content at the LSN. From the error message

    Execution of filter stored procedure 2048634987 failed.

    You can check whether 2048634987 is present in sys.articles and is not present in sys.objects by running the query given in post

    To resolve following the resolution given in the post

  3. DBinOC says:

    This is great! I had been struggling with this for a number of days until I found this article.  The only part that is troubling me is why do the filter procs disappear?

  4. Alexander says:


    I have exactly the same sympthoms, but the filtering article is present in the publication database.

    Appreciate your help.



  5. SQL-Expert says:


    But if we re-initialize the subscription. It will take a new snapshot will all publish all the tables.

  6. SQl expert says:

    Still its same error , again process all steps

Skip to main content