Tuesday, August 14, 2012

Replication - find replication error command

Find Replication error command :
from distribution database, Keying publisherDB name and commandId

declare @PublisherDB sysname,
@PublisherDBID int,@SeqNo nchar(22),@CommandID int

-- Set publisher database name and values from Replication Monitor
set @PublisherDB='publisherdatabasename'

--Set @SeqNo = N'0x0000030100001D68000A0000000'
--Set @CommandID=956
Set @SeqNo = N'valuefromreplicationmonitor'
Set @CommandID ='value from replicationmonitor'

select top 1 @PublisherDBID =publisher_database_id from MSdistribution_agents(nolock)
where publisher_db=@PublisherDB
-- Get the command
Exec sp_browsereplcmds
@xact_seqno_start = @SeqNo,
@xact_seqno_end = @SeqNo,
@command_id = @CommandID,
@publisher_database_id=@PublisherDBID;

In result return, look for command column

No comments: