--- title: "Distributor and Publisher Information Script | Microsoft Docs" ms.custom: "" ms.date: "03/09/2017" ms.prod: sql ms.prod_service: "database-engine" ms.reviewer: "" ms.technology: replication ms.topic: conceptual helpviewer_keywords: - "Publishers [SQL Server replication], information scripts" - "Distributors [SQL Server replication], information scripts" ms.assetid: 8622db47-c223-48fa-87ff-0b4362cd069a author: "MashaMSFT" ms.author: "mathoma" monikerRange: "=azuresqldb-mi-current||>=sql-server-2016||=sqlallproducts-allversions" --- # Distributor and Publisher Information Script [!INCLUDE[appliesto-ss-asdbmi-xxxx-xxx-md](../../../includes/appliesto-ss-asdbmi-xxxx-xxx-md.md)] This script uses system tables and replication stored procedures to answer questions commonly asked about objects at the Distributor and Publisher. The script can be used "as-is" and can also provide the basis for customized scripts. The script might require two modifications to run in your environment: - Change the line `use AdventureWorks2012` to use the name of your publication database. - Remove the comments (`--`) from the line `exec sp_helparticle @publication=''` and replace \ with the name of a publication. ``` --********** Execute at the Distributor in the master database **********-- USE master; go --Is the current server a Distributor? --Is the distribution database installed? --Are there other Publishers using this Distributor? EXEC sp_get_distributor --Is the current server a Distributor? SELECT is_distributor FROM sys.servers WHERE name='repl_distributor' AND data_source=@@servername; --Which databases on the Distributor are distribution databases? SELECT name FROM sys.databases WHERE is_distributor = 1 --What are the Distributor and distribution database properties? EXEC sp_helpdistributor; EXEC sp_helpdistributiondb; EXEC sp_helpdistpublisher; --********** Execute at the Publisher in the master database **********-- --Which databases are published for replication and what type of replication? EXEC sp_helpreplicationdboption; --Which databases are published using snapshot replication or transactional replication? SELECT name as tran_published_db FROM sys.databases WHERE is_published = 1; --Which databases are published using merge replication? SELECT name as merge_published_db FROM sys.databases WHERE is_merge_published = 1; --What are the properties for Subscribers that subscribe to publications at this Publisher? EXEC sp_helpsubscriberinfo; --********** Execute at the Publisher in the publication database **********-- USE AdventureWorks2012; go --What are the snapshot and transactional publications in this database? EXEC sp_helppublication; --What are the articles in snapshot and transactional publications in this database? --REMOVE COMMENTS FROM NEXT LINE AND REPLACE with the name of a publication --EXEC sp_helparticle @publication=''; --What are the merge publications in this database? EXEC sp_helpmergepublication; --What are the articles in merge publications in this database? EXEC sp_helpmergearticle; -- to return information on articles for a single publication, specify @publication='' --Which objects in the database are published? SELECT name AS published_object, schema_id, is_published AS is_tran_published, is_merge_published, is_schema_published FROM sys.tables WHERE is_published = 1 or is_merge_published = 1 or is_schema_published = 1 UNION SELECT name AS published_object, schema_id, 0, 0, is_schema_published FROM sys.procedures WHERE is_schema_published = 1 UNION SELECT name AS published_object, schema_id, 0, 0, is_schema_published FROM sys.views WHERE is_schema_published = 1; --Which columns are published in snapshot or transactional publications in this database? SELECT object_name(object_id) AS tran_published_table, name AS published_column FROM sys.columns WHERE is_replicated = 1; --Which columns are published in merge publications in this database? SELECT object_name(object_id) AS merge_published_table, name AS published_column FROM sys.columns WHERE is_merge_published = 1; ``` ## See Also [Frequently Asked Questions for Replication Administrators](../../../relational-databases/replication/administration/frequently-asked-questions-for-replication-administrators.md) [sp_get_distributor (Transact-SQL)](../../../relational-databases/system-stored-procedures/sp-get-distributor-transact-sql.md) [sp_helparticle (Transact-SQL)](../../../relational-databases/system-stored-procedures/sp-helparticle-transact-sql.md) [sp_helpdistributiondb (Transact-SQL)](../../../relational-databases/system-stored-procedures/sp-helpdistributiondb-transact-sql.md) [sp_helpdistpublisher (Transact-SQL)](../../../relational-databases/system-stored-procedures/sp-helpdistpublisher-transact-sql.md) [sp_helpdistributor (Transact-SQL)](../../../relational-databases/system-stored-procedures/sp-helpdistributor-transact-sql.md) [sp_helpmergearticle (Transact-SQL)](../../../relational-databases/system-stored-procedures/sp-helpmergearticle-transact-sql.md) [sp_helpmergepublication (Transact-SQL)](../../../relational-databases/system-stored-procedures/sp-helpmergepublication-transact-sql.md) [sp_helppublication (Transact-SQL)](../../../relational-databases/system-stored-procedures/sp-helppublication-transact-sql.md) [sp_helpreplicationdboption (Transact-SQL)](../../../relational-databases/system-stored-procedures/sp-helpreplicationdboption-transact-sql.md) [sp_helpsubscriberinfo (Transact-SQL)](../../../relational-databases/system-stored-procedures/sp-helpsubscriberinfo-transact-sql.md) [sys.columns (Transact-SQL)](../../../relational-databases/system-catalog-views/sys-columns-transact-sql.md) [sys.databases (Transact-SQL)](../../../relational-databases/system-catalog-views/sys-databases-transact-sql.md) [sys.procedures (Transact-SQL)](../../../relational-databases/system-catalog-views/sys-procedures-transact-sql.md) [sys.servers (Transact-SQL)](../../../relational-databases/system-catalog-views/sys-servers-transact-sql.md) [sys.tables (Transact-SQL)](../../../relational-databases/system-catalog-views/sys-tables-transact-sql.md) [sys.views (Transact-SQL)](../../../relational-databases/system-catalog-views/sys-views-transact-sql.md)