Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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?

Thanks.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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