Rahman Agoro, the frontline SQL DBA

Just another WordPress.com weblog

Archive for March, 2016

Cannot drop database XXXX because it is being used for replication.

Posted by rahmanagoro on March 15, 2016

If you have ever come across this error, its because replication has been setup on the database before and it needs to be removed before the database can be dropped.

In my case, I had the error when I tried to run the code below.

drop database TEST_FWXXX

Server: Msg 3724, Level 16, State 3, Line 1
Cannot drop the database XXX because it is being used for replication.


Please note that in this case, the publication and subscription had already been dropped. Simple to resolve, just remove the replication property on the DB by running the code below.

exec sp_removedbreplication ‘TEST_FWXXX’

After running this, I was then able to drop the database successfully.



Posted in Management, SQL replication | Leave a Comment »