Last active
May 20, 2021 08:37
-
-
Save melvinlee/9d6a45facec82b120a233bcbad4db617 to your computer and use it in GitHub Desktop.
Delete SQL Replication command from Distribution Database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Identify repl errors | |
USE [DISTRIBUTOR] | |
SELECT * FROM MSrepl_errors | |
ORDER BY time DESC | |
-- Identify the publisher database id | |
SELECT * FROM MSpublisher_databases | |
-- Identify the ID number and command id of the command causing the problem. | |
-- This will typically show up in the Replication Monitor. | |
-- To locate articles that not in sync. | |
SELECT * FROM dbo.MSarticles | |
WHERE article_id in ( | |
SELECT article_id FROM MSrepl_commands | |
WHERE xact_seqno = 0x00032F6B00000845000500000000) | |
-- To identify the command with the problem. | |
EXEC sp_browsereplcmds | |
@xact_seqno_start = '0x00032F6B0000084B000300000000', | |
@xact_seqno_end = '0x00032F6B0000084B000300000000', | |
@publisher_database_id = 18, | |
@command_id = 1 | |
-- Delete the command from MSRepl_commands using the xact_seqno and command_id | |
SELECT * FROM MSrepl_commands WHERE xact_seqno = 0x00032F6B0000084B0003 | |
DELETE FROM MSrepl_commands where xact_seqno = 0x00032F6B0000084B0003 and command_id = 1 and publisher_database_id = 18 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment