Friday 6 February 2015

SQL for showing outstanding replication commands

The collection of T-SQL below helps identify outstanding replication commands
use distribution
go
select * from dbo.MSarticles
where article_id IN (SELECT Article_id from MSrepl_commands
where xact_seqno = 0x0002E17600000131000600000000)

sp_browsereplcmds @xact_seqno_end = '0x0002E17600000131000600000000'
sp_browsereplcmds @xact_seqno_start = '0x0002E17600000131000600000000', @xact_seqno_end = '0x0002E17600000131000600000000', @Command_id = 1, @publisher_database_id = 1

select * FROM MSArticles a where article in ('DiscountCode', 'DiscountCodeCountry', 'DiscountRule')
select * from M

-- Discount Code
sp_browsereplcmds @article_id = 60, @xact_seqno_end = '0x0002E17600000131000600000000'
sp_browsereplcmds @article_id = 61, @xact_seqno_end = '0x0002E17600000131000600000000'
sp_browsereplcmds @article_id = 62, @xact_seqno_end = '0x0002E17600000131000600000000'

EXECUTE sp_replmonitorsubscriptionpendingcmds 
@publisher ='.\PublisherDb', -- Put publisher server name here
@publisher_db = 'MyPubDb', -- Put publisher database name here
@publication ='Discount-Publication',  -- Put publication name here
@subscriber ='.\SubscriberDb', -- Put subscriber server name here
@subscriber_db ='MySubDb', -- Put subscriber database name here
@subscription_type ='0' -- 0 = push and 1 = pull

No comments:

Post a Comment