Cannot drop the database because it is being used for replication

Cannot drop the database because it is being used for replication
Download PDF


I have been doing more and more replication work lately, and when recently testing some replication work I needed to create and drop some test databases and re-test the replication work.

After configuring a database for replication, then deleting the publisher and the subscriber I attempted to drop the database and get the following error:

Msg 3724, Level 16, State 3, Line 7
Cannot drop the database ‘ReplicationTableTest1’ because it is being used for replication.

I had to remove replication from the database even though it had no publications or subscribers, that was done by the following:

USE [ReplicationTableTest1]

EXEC sp_removedbreplication @dbname=[ReplicationTableTest1]

or more generically like this:

USE [YourDatabaseName]

EXEC sp_removedbreplication @dbname=[YourDatabaseName]

If you run into the same error message I hope this helps.

 

More from Stedman Solutions:

SteveStedman5
Steve and the team at Stedman Solutions are here for all your SQL Server needs.
Contact us today for your free 30 minute consultation..
We are ready to help!

Leave a Reply

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

*