Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix Recovery Pending State in SQL Server Database?

Tags:

sql-server

How to fix Recovery Pending State in SQL Server Database?

like image 630
Mahesh Thorat Avatar asked Sep 14 '18 05:09

Mahesh Thorat


People also ask

Why is SQL recovery pending?

Recovery Pending: When the SQL server knows that the database needs to be restored but there is an obstacle before starting. This status differs from the suspect mode because it cannot be declared that the database restore has failed but the process has not yet started.

How do I get rid of database recovery pending?

Right-Click on the Database and Delete it to remove SQL recovery pending state permanently.

How do I resolve a database restoring state?

If you receive an error that the database is in use, try to set the user to single user mode: USE master; GO ALTER DATABASE Database_name SET SINGLE_USER WITH ROLLBACK IMMEDIATE; Then try the restore with recovery command again. Also, make sure you are on the latest service pack or cumulative update.

How do I fix an EMERGENCY state in SQL Server?

If your database is stuck in EMERGENCY mode, try to look for the last backup to restore the database and recover its information. If the backup is corrupt or unavailable, use a SQL recovery tool like Stellar Repair for MS SQL to restore your database to its original state.


2 Answers

Execute the following set of queries:

ALTER DATABASE [DBName] SET EMERGENCY; GO  ALTER DATABASE [DBName] set single_user GO  DBCC CHECKDB ([DBName], REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS; GO   ALTER DATABASE [DBName] set multi_user GO 

For more info: https://www.stellarinfo.com/blog/fix-sql-database-recovery-pending-state-issue/

like image 59
Mahesh Thorat Avatar answered Oct 11 '22 14:10

Mahesh Thorat


When your Database .mdf file name is renamed, this issue is occurred. To solve:

Restart SQL EXPRESS in Services, Pending issue is solved.

like image 21
Kaviya Mahadevan Avatar answered Oct 11 '22 14:10

Kaviya Mahadevan