Question

I store my data for a web app in SQL Server 2008 R2. When I connected to SSMS today my database had a (In Recovery) in front of it.

When I ran this query: SELECT databasepropertyex('nyDatabase', 'STATUS')

The status comes as ONLINE.

I am confused as to what I should do next.

Does that mean recovery has happened successfully. If yes, then why does SQL has In Recovery in front of db still?

Was it helpful?

Solution

With SQL Server Express 2008R2, the AUTO_CLOSE property is set to true by default:

Setting Database Options

True for all databases when using SQL Server 2000 Desktop Engine or SQL Server Express, and False for all other editions, regardless of operating system.

When set, this property can cause the behaviour you're seeing, i.e. SSMS queries the SQL Server metadata and at particular instant the database is being opened.

If you set AUTO_CLOSE to false, this should disappear.

You'll find few recommendations to have this set, anyway. You can see through this link that it's actually deprecated in 2008R2 so it's odd that it's still set by default in some circumstances.

Microsoft employee Buck Woody describes why this setting is not much help:

SQL Server Best Practices: AutoClose Should be Off

Basically, in all but the most unused databases it causes more work for the database engine than it prevents.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top