23

Today, after a power failure, one database (with Recovery: full) shows "In Recovery" in SSMS. So:

myDatabase (In recovery) (database status: recovery, Shutdown)

After finish, the "recovery process" the database shows the name myDatabase without "(In recovery)". I thought that the problem was solved, but it was not.

When I started the application that uses that database, the extra text "(In recovery)" appears again next to the name of my database.

I waited until the "recovery process" finished and then I took the database offline and brought it back online.

I restarted the server, restarted the computer and when my application was running the extra text appears again. In the SQL Server logs the message "Starting up database 'myDatabase'" appears few times. It seems that the database is working because I can insert data, but the state is showing that something it happens.

The server log is not showing anything interesting. The only abnormal thing is that I have 30 entries of "Starting up database 'myDatabase'".

I know that when the server starts every database goes through recovery before it is ready for use. But in my case, the database comes online then shows "myDatabase (In recovery)". If I close the application, the database goes to Status: Normal. This is driving me crazy.

I've even installed a new instance of SQL Server, and put the old database "myDatabase" on it. The problem still happens.

When I run this query:

SELECT databasepropertyex('nyDatabase', 'STATUS')

It shows recovering, online, suspect and the back to online and then recovering and so on.

migrated from stackoverflow.com Jan 21 '12 at 20:19

This question came from our site for professional and enthusiast programmers.

2

Community wiki answer originally left as an edit to the question by its author:

The problem was that the database property AutoClose was set on.

The solution was to set AutoClose to false.

16

I am not sure if this would help solve the issue, but you can give it a shot.

Run:

RESTORE DATABASE YourDatabase WITH RECOVERY

See if the above brings the database out of recovering mode. If it doesn't then the problem may be something else.

Can you try the below command and see if the database is corrupt?

DBCC CHECKDB ('YourDBname') WITH NO_INFOMSGS, ALL_ERRORMSGS

If it detects corruption, then you might want to repair the database using DBCC CHECKDB

6

Whenever you bring a database online, it goes through a recovery process. I'm a bit confused by your phrasing of the problem though. Are you seeing the database go into recovery any time other than when the database is being brought offline (either from your original power failure or by your having brought it offline and then online again)? If so, the database is going offline for some other reason. Best to check the SQL server logs to see what's going on.

You should also check the Windows event log for something like a disk failure. The database should not be starting up and going into recovery during normal operations.

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