开发者

How to get last synchronization date and server

开发者 https://www.devze.com 2023-03-11 18:54 出处:网络
I have a central suscriber with 5 publishers.After replication, I want to get the last synchronization date and the 开发者_StackOverflow社区server that made that synchronization.Is it possible to find

I have a central suscriber with 5 publishers. After replication, I want to get the last synchronization date and the 开发者_StackOverflow社区server that made that synchronization. Is it possible to find this information from existing tables that SQL Server uses for replication?


I use something simmiler to this to check last replication times. However this is on a database level and not a table level. this is ran from the distribution database of the publisher.

SELECT      MAX(DISTINCT h.[time]) AS RunTime
FROM            MSmerge_history h INNER JOIN
        MSmerge_agents a ON a.id = h.agent_id
WHERE       (a.publisher_db = 'PublishedDbName') 
AND (h.runstatus <> 1) 
AND Left(h.comments,2) = 'Up' 
OR (a.publisher_db = 'PublishedDbName') 
AND (h.runstatus <> 1) 
AND Left(h.comments,2) = 'No' 
OR (a.publisher_db = 'PublishedDbName') 
AND (h.runstatus <> 1) 
AND Left(h.comments,2) = 'Me'
And Publication Like 'PublictionName%'
GO
0

精彩评论

暂无评论...
验证码 换一张
取 消