I tried to detach the database in one of our SQL servers, but received the following error:-
Cannot detach a suspect or recovery pending database. It must be repaired or dropped. (Microsoft SQL Server, Error: 3707)
To resolve i did the following steps:-
ALTER DATABASE AdventureWorks2012 SET EMERGENCY; GO
- In EMERGENCY mode database marks as READ_ONLY and also disabled the logging.
- In EMERGENCY mode sysadmins also having the limited access.
- Marking the database in EMERGENCY mode is a first step for resolving log corruption.
ALTER DATABASE AdventureWorks2012 set single_user GO DBCC CHECKDB (AdventureWorks2012, REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS; GO ALTER DATABASE AdventureWorks2012 set multi_user GO
Above steps resolve any corruption and bring the database online and The database will come out of EMEREGENCY mode automatically in Sql Server.