Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a database that has entered "Recovery Mode". It was working fine, but ended up in this status a few days ago.

I have been told that a cause can be the partition holding the datafiles running out of space. However in this case the drive has plenty of space. The log files for the database are also of a reasonable size (300-450mb)

I found this script on google that is meant to return the about of time a database has left before recovery is complete. It dosn't give me any results. We do not have a backup of the database, and we really need its data back

DECLARE @DBName VARCHAR(64) = 'databasename'

DECLARE @ErrorLog AS TABLE([LogDate] CHAR(24), [ProcessInfo] VARCHAR(64), [TEXT]  VARCHAR(MAX))

EXEC sys.xp_readerrorlog 0, 1, 'Recovery of database', @DBName

,SUBSTRING([TEXT], CHARINDEX(') is ', [TEXT]) + 4,CHARINDEX(' complete (', [TEXT])  - CHARINDEX(') is ', [TEXT]) - 4) AS PercentComplete
,CAST(SUBSTRING([TEXT], CHARINDEX('approximately', [TEXT]) + 13,CHARINDEX(' seconds remain', [TEXT]) - CHARINDEX('approximately', [TEXT]) - 13) AS FLOAT)/60.0 AS MinutesRemaining
,CAST(SUBSTRING([TEXT], CHARINDEX('approximately', [TEXT]) + 13,CHARINDEX(' seconds remain', [TEXT]) - CHARINDEX('approximately', [TEXT]) - 13) AS FLOAT)/60.0/60.0 AS HoursRemaining

FROM @ErrorLog ORDER BY [LogDate] DESC
share|improve this question
Has it been restored at all (from backup)? Is autoclose on? – gbn Jan 31 '13 at 15:30
supporter organization of database says that there is no any backup. i dont know what happened because i didn't see this database before this problem – Pezhman Parsaee Jan 31 '13 at 15:41
i can't see table and other content of database and i can not run query against databse. this error was happened when i try to run query against this database : Database 'Manager' is being recovered. Waiting until recovery is finished. – Pezhman Parsaee Jan 31 '13 at 15:45
Impossible to answer without relevant parts of errorlog. Post more info to get sensible answers. Don't take anyone's advice for good, especially if suggests deleting or moving files. – spaghettidba Jan 31 '13 at 15:50

Check out Paul Randal's recommendations: Set the database to EMERGENCY mode, the database will be accessible to sysadmins only. It'll be read-only, so nothing can be written to the transaction log

Using EMERGENCY mode to access a RECOVERY PENDING or SUSPECT database

share|improve this answer

I often see databases enter this mode when they are the target of a log-shipping (or automated apply) and a single log file has been damaged.

Unless you have a backup of the database you trust, and transaction logs to take it back up to date the only thing I can suggest is this. BUT be warned, you may loose data integrity.


Please Note: You should really find out why your database ended up in recovery mode before trying to repair it. The SQL error logs should give you an idea. Also in the future, I can't stress how important proper backups are (ensure you keep them on a seperate system from the database server!).

share|improve this answer
This is one way to remedy this, but I would strongly recommend establishing the reason why your database is in recovery mode before attempting any solution to bring it out of recovery. This information should be provided in the SQL Error Log. – Mike Fal Feb 1 '13 at 20:56
I agree with Mike (answer updated), this routine should only be used as a last ditch resort to bring a db back from the dead. – jamesakadamingo Feb 1 '13 at 21:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.