how to bring reverting/in recovery secondary db back online after failover

Jiong AN 146 Reputation points
2020-10-26T03:26:22.967+00:00

Hi, we have always on AG which is in synchronized-commit, auto failover mode. one of busy database was in synchronized. After I performed a manual failover to its secondary. The new secondary (the old primary) takes forever stay in 'reverting/in recovery' mode for hours and hours. the db is about 8G data + 3G log. I can't bring the secondary back online at all. I can't do restore, take offline or delete the database (even after I take the db off from AG group). I have checked the percentage of completion for the secondary in recovery from reverting, but after 15hours it went from 0% to 90% complete, then it goes back to 0% again. The only way to fix is by restarting the secondary machine, it then will kill the system process which was locking the master db. the db on secondary changes to 'suspend' mode, i can then delete the database and resync. but problem is when i trying to fail back after synced. this problem happened again on the new secondary. My question is how can I bring the db out of reverting mode without restart the server. By the way, restarting mssql services does not help. because the mssql service stuck at shutting down.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,653 questions
{count} votes

Accepted answer
  1. m 4,271 Reputation points
    2020-10-27T01:24:08.28+00:00

    Hi @Jiong AN ,

    Is the reply helpful?

    BR,
    Mia


    If the answer is helpful, please click "Accept Answer" and upvote it.

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. m 4,271 Reputation points
    2020-10-26T07:11:02.863+00:00

    Hi @Jiong AN ,

    ...My question is how can I bring the db out of reverting mode without restart the server. By the way, restarting mssql services does not help. because the mssql service stuck at shutting down.

    Quote from this case: replica-database-in-reverting-in-recovery
    Force remove it from availability group. Truncate primary log. Restore the Database to secondary from latest primary backup. Re Configure Availability group by adding the secondary server if tran log is huge else, add the secondary using wizard and create the secondary database instance.

    More information: troubleshooting-alwayson-availability-databases-in-a-recovery-pending

    BR,
    Mia


    If the answer is helpful, please click "Accept Answer" and upvote it.

    1 person found this answer helpful.

  2. m 4,271 Reputation points
    2020-10-26T09:02:23.987+00:00

    Hi @Jiong AN ,

    Can you show me the error message?
    Or could you please try code as next?
    DBCC CHECKDB

    BR,
    Mia


    If the answer is helpful, please click "Accept Answer" and upvote it.