3

I have a database in SQL Server 2012 that is on the secondary replica of an availability group. I removed the database from the AG db list on the primary and the db is currently in the Restoring state on the secondary.

The problem is that I'm unable to drop the database off the secondary.

DROP DATABASE [ZOMBIEDB]

Gives me the following error:

"The database 'ZOMBIEDB' is currently joined to an availability group. Before you can drop the database, you need to remove it from the availatility group."

However:

ALTER DATABASE [ZOMBIEDB] SET HADR OFF;

Yields the following error:

"Cannot complete this ALTER DATABASE SET HADR operation on database 'ZOMBIEDB'. The database is not joined to an availability group. After the database has joined the availability group, retry the command."

So, how do I convince SQL Server that the db isn't in an AG so I can drop it?

2 Answers 2

2

I pulled the oldest full backup I could find and was able to restore that over the Restoring db using:

RESTORE DATABASE [ZOMBIEDB] FROM  DISK = N'D:\ZOMBIEDB.bak' WITH  FILE = 1,  NOUNLOAD,  REPLACE,  STATS = 5

I was then able to delete the restored database.

1

I had to stop and restart the SQL Server service on the node with the db stuck in restoring state. Then I was able to drop the database.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.