Sql-Server

Sql Server:如何從 Publisher 查詢訂閱和文章列表(對於給定的出版物)

  • March 7, 2019

在 Sql Server 2014 中,如何從 Publisher查詢給定出版物的訂閱列表及其文章?(事務複製)

是的,有更簡單的方法可以從Distributor查詢,但我需要 Publisher 端的查詢。

遠端分銷商模型(如果有幫助)

謝謝,

要從發布者數據庫獲取訂閱列表,您可以在 tsql 下執行:

use publisherDB;
select  
db_name() PublisherDB 
, sp.name as PublisherName 
, sa.name as TableName 
, UPPER(srv.srvname) as SubscriberServerName 
from dbo.syspublications sp  
join dbo.sysarticles sa on sp.pubid = sa.pubid 
join dbo.syssubscriptions s on sa.artid = s.artid 
join master.dbo.sysservers srv on s.srvid = srv.srvid 

如果有人需要合併複製:

use publisherDB
go
select distinct 
   sa.name as articlename,
   sp.publisher as publisherserver,
   sp.publisher_db as publisherdb,
   sp.name as publicationname
   ,ss.subscriber_server as subscriberservername 
from dbo.sysmergearticles sa
join dbo.sysmergepublications sp on sa.pubid = sp.pubid
join dbo.sysmergesubscriptions ss on ss.pubid = sa.pubid
order by subscriberservername

找到這個 sys proc,不確定它是否正確。

sp_helpsubscription

有更好解決方案的想法嗎?

謝謝,

引用自:https://dba.stackexchange.com/questions/222460