Sql-server – Removing Databases in Recovery Pending Status after AG group was removed

hadrsql-server-2012

I have removed a High Availability Group, disabled the option in sql configuration manager and restarted and I have also removed the Failover cluster components from windows and restarted.

Unfortunately the databases are marked as Recovery Pending on both servers.

I have attempted to drop them, but get this:

Msg 3752, Level 16, State 1, Line 1

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

I also tried to recovery the db with no success and also set it into emergency mode but cannot:

The operation cannot be performed on database "GEO" because it is involved in a database mirroring session or an availability group. Some operations are not allowed on a database that is participating in a database mirroring session or in an availability group.

I even tried to brute force the server by stopping the engine and renaming the file to try to get it into suspect, but its still in recovery pending… I cant re-enable the HADR settings as the windows cluster has been destroyed.

All systems catalogs are empty apart from sys.availability_replicas which has a reference to the other server (first time in a few years I wish I was back in the good old days when I could access system tables).

Any ideas how to get rid of these databases?

Best Answer

To resolve this I had to recreate the whole Failover cluster, re-enable HA in the SQL Configuration manager and then I could set one of the db's to recover