How to Check if Replication is Enabled in SQL Server

When we need to delete/restore a SQL database. We must have to check first if the replication is setup or not on that database. If replication is set and you are trying to delete/restore a database then it may cause an issue.

How to Check if Replication is Enabled in SQL Server

It’s a good practice to check first if the replication is setup or not and if yes then you need to ask IT to stop replication before deleting/restoring a DB.

Solution:

This is an easiest way to check if replication is enabled in a SQL Server. It will not return any status info but just will let you know if it’s enabled for a DB.

When a user database is configured as a Publisher or a Subscriber, replication adds system tables to the database.

Script:

select name, is_published, is_subscribed, is_merge_published, is_distributor
from sys.databases
where is_published = 1 or is_subscribed = 1 or
is_merge_published = 1 or is_distributor = 1

OutPut:

How to Check if Replication is Enabled in SQL Server


<<Click here to see all posts>>

Leave a Reply

Your email address will not be published. Required fields are marked *

Prove You Are Human Time limit is exhausted. Please reload CAPTCHA.