Search This Blog

Tuesday, December 14, 2010

Monitoring Transactional Replication Status - SQL Server 2005, 2008, 2008 R2

USE DISTRIBUTION
GO
SELECT
      s.agent_id
      ,a.id
      ,s.article_id
      ,a.subscriber_id
      ,ar.Source_owner
      ,ar.Source_object
      ,ar.destination_owner
      ,ar.destination_object
      ,s.undelivcmdsindistdb
      ,a.publisher_db
      ,a.subscriber_db
      ,a.publication
FROM distribution.dbo.msdistribution_status s with (nolock)
INNER JOIN (SELECT * FROM msdistribution_agents with (nolock)) AS a ON a.id = s.agent_id
INNER JOIN (SELECT * FROM msarticles with (nolock)) AS ar
            ON ar.article_id = s.article_id
                  AND a.publisher_Db = ar.publisher_db
WHERE a.subscriber_db<>'virtual'
AND s.undelivcmdsindistdb>0
ORDER BY  s.undelivcmdsindistdb DESC

No comments: