With SQL Server Express 2008R2, the AUTO_CLOSE
property is set to true
by default:
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.