I recently wrote about recovering a secondary database in an AlwaysOn High Availability setup when the Availability Group and Primary Replica are offline. In that case I simply needed to get the data from the secondary replica online without the AG or the primary replica online, it didn’t matter how, I just needed the data. In another case however, I had the opposite scenario: Data from the primary replica was stuck in a “Not Synchronizing / Recovery Pending” state because the availability group was unable to resolve, and the secondary replica was offline. In this case I also needed to bring the data online in its original state in the existing database, with the end goal also to gracefully decommission the always on high availability setup.
You can see in the images below that the Availability Group is stuck resolving, and also the Secondary Replica is offline. Thus the problem being I was unable to get my primary replica out of the resolving state. I should note that the perplexing part about this was that the availability group listener was online and healthy, the IP was accessible and the quorum was normal, so it seemed that everything should have been fine to work as expected even with the secondary replica offline.


What finally helped me resolve this was the following to articles:
https://www.mssqltips.com/sqlservertip/4917/recover-wsfc-using-forced-quorum-for-sql-server-alwayson-availability-group/
https://sqlgeekspro.com/force-failover-alwayson-group/
Both were close to my scenario with one exception; in my case the quorum was in a healthy state, where as both of these scenarios described required a restart of the cluster service with force quorum.
In my case it turns out the problem was simply the AG being unable to resolve, so by forcing failover to the primary replica, everything else resolves itself.
Simply run this command on your primary replica (or the one you want to become primary) : ALTER AVAILABILITY GROUP MYTEST_AG FORCE_FAILOVER_ALLOW_DATA_LOSS;
One I ran this the Availability Group came online and I was then able to remove the databases that were stuck resolving from the group and everything was back to working fine. In my case I was obsoleting the AG so this was desired, but no matter your case it should be enough to make your data accessible to then manage things through the SQL High Availability dashboard.