列出当前发布用于复制 MS-SQL 的所有表

发布于 2024-08-27 17:10:42 字数 63 浏览 12 评论 0原文

我需要获取为从 MS-SQL 数据库复制而发布的所有表的列表。是否有系统存储过程或查询可以运行来生成这样的列表?

I need to get a list of all tables that are published for replication from MS-SQL databases. Is there a system stored procedure or a query I could run to generate such a list?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

只是在用心讲痛 2024-09-03 17:10:42

是:

SELECT *
FROM sys.tables
WHERE is_replicated = 1

来自 MSDN 的 is_replicated 字段:

1 = 使用快照发布表
复制或事务性
复制。

Yes:

SELECT *
FROM sys.tables
WHERE is_replicated = 1

From MSDN for is_replicated field:

1 = Table is published using snapshot
replication or transactional
replication.

北音执念 2024-09-03 17:10:42

可以查询distribution数据库来查看发布了哪些文章(表/视图/对象...)以及它们来自哪个出版物。

SELECT
     P.[publication]   AS [Publication Name]
    ,A.[publisher_db]  AS [Database Name]
    ,A.[article]       AS [Article Name]
    ,A.[source_owner]  AS [Schema]
    ,A.[source_object] AS [Object]
FROM
    [distribution].[dbo].[MSarticles] AS A
    INNER JOIN [distribution].[dbo].[MSpublications] AS P
        ON (A.[publication_id] = P.[publication_id])
ORDER BY
    P.[publication], A.[article];

It's possible to query the distribution database to see what articles (tables/views/objects...) are published and which Publication they are from.

SELECT
     P.[publication]   AS [Publication Name]
    ,A.[publisher_db]  AS [Database Name]
    ,A.[article]       AS [Article Name]
    ,A.[source_owner]  AS [Schema]
    ,A.[source_object] AS [Object]
FROM
    [distribution].[dbo].[MSarticles] AS A
    INNER JOIN [distribution].[dbo].[MSpublications] AS P
        ON (A.[publication_id] = P.[publication_id])
ORDER BY
    P.[publication], A.[article];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文