Abandon Pending Log Reads
A three-line recovery script that resets the log reader and flushes replication when pending reads must be abandoned.
Sometimes the cleanest way out of a stuck log reader is to simply abandon what it has queued up and start over. This short script does exactly that on the publisher: sp_repldone with @reset = 1 marks everything as done, sp_replrestart resets the agent's position, and sp_replflush releases the transaction-log access so the SQL Agent log reader can scan again.
EXEC sp_repldone @xactid = NULL, @xact_segno = NULL, @numtrans = 0, @time = 0, @reset = 1
exec sp_replrestart
exec sp_replflush