When you find an issue in replication with the error “The row was not found at the Subscriber when applying the replicated command.”, first we have to get the Transaction sequence number and Command ID from the error.
This can be found at Distributer to Subscriber history in replication monitor.
Once we get the Transaction Sequence Number and Command ID we can easily drill down to the command which is causing the issue by using sp_browsereplcmds. Before to this, we have to also find out publisher_database_id.
For finding publisher_database_id, we need to make use of Transaction Sequence Number and Command ID.
Query to find publisher_database_id using Transaction Sequence Number and Command ID
select * from msrepl_commands
where xact_seqno = 0x000BF8FB0003411E000400000000 and command_id=6
Once we get the publisher_database_id from the above query, then we need to execute the below query to get the command which is causing the error.
Query to find the command which is causing error
exec sp_browsereplcmds @xact_seqno_start = '0x000BF8FB0003411E000400000000',
@xact_seqno_end = '0x000BF8FB0003411E000400000000', @Command_id=6, @publisher_database_id=60
Once we get the command, we can manually sync the missing data from publisher to subscriber to make the replication work fine as before.
Note: All these commands have to be run on distribution database.
This article is also available in pdf format for downloading.
Please Click here to get your copy.