Cannot drop the database [database_name] because it is being used for replication
If you ever found yourself in such a bizzare situation, read how to overcome this. Recently I was working in my test environment, trying several things regarding replication. After numerous setups, removals, backups, restores etc, I found mysefl in a situation where:
- no replication was set up
- no distribution database was present
- a former subscriber database was left
Trying to delete the database in question, the error message has come up. “Cannot drop the database [database_name] because it is being used for replication”. Ater trying several commands to remove replication options from the database, delete always failed.
Finally, I managed to delete the database after taking it offline. So this is a way to go.
- Take database offline
- Delete the database