Tuesday, July 30, 2019

SQL Server database went to Recovery Pending State


My SQL server went to "Recovery Pending" state after I mistakenly enabled folder compression for the folder where the database files are residing.
To recover,

  1. Stop SQL services
  2. Disable folder compression in the folder where SQL database files are stored
  3. Start SQL services
  4. Execute below recovery steps if still having trouble to use the DB. in case the DB went to single user mode, just the last step from below is needed

ALTER DATABASE [SQL-DB-Name] SET EMERGENCY;
GO

ALTER DATABASE [SQL-DB-Name] set single_user
GO

DBCC CHECKDB ([SQL-DB-Name], REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS;
GO

ALTER DATABASE [SQL-DB-Name] set multi_user
GO

Turn on Windows 11 Fast Boot

If windows starting is slow, to enable windows 11 fast startup/boot,  Press Windows + R, type powercfg.cpl, and hit Enter.  This will direct...