Home > SQL Server Replication > Transactional Replication Information (Publisher–Publication-Articles-Subscriber–Articles)

Transactional Replication Information (Publisher–Publication-Articles-Subscriber–Articles)

Written a script to pull list of each table in a subscription and when the last time the table replicated.

use [distribution]

select sss.srvname PublisherServer,mss.publication_id,mss.publisher_db,
msa.article Publisher_Articals,
sss1.srvname SubscriberServer,mss.subscriber_id,mss.subscriber_db,mss.article_id,
msa.destination_object Subscriber_Articals,
mss.subscription_time
from MSsubscriptions mss join
sys.sysservers sss on mss.publisher_id=sss.srvid join sys.sysservers sss1
on mss.subscriber_id=sss1.srvid
join MSarticles msa on mss.publisher_id=msa.publisher_id and mss.article_id=msa.article_id

 
 
 
 
  1. February 7, 2012 at 4:48 pm

    Inner join with MSarticles need one additional condition otherwise it might not give correct result if one article is part to two publications.

    Suggested Modification (Additional condition) is highlighted below

    use [distribution]

    select sss.srvname PublisherServer,mss.publication_id,mss.publisher_db,
    msa.article Publisher_Articals,
    sss1.srvname SubscriberServer,mss.subscriber_id,mss.subscriber_db,mss.article_id,
    msa.destination_object Subscriber_Articals,
    mss.subscription_time
    from MSsubscriptions mss join
    sys.sysservers sss on mss.publisher_id=sss.srvid join sys.sysservers sss1
    on mss.subscriber_id=sss1.srvid
    join MSarticles msa on mss.publisher_id=msa.publisher_id and mss.article_id=msa.article_id
    — Additional condition
    and mss.publication_id = msa.publication_id

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: