SQL Server has encountered 1 occurrence(s) of cachestore flush

I also saw this in my own environment along with a few other messages:

  1. SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'Bound Trees' cachestore (part of plan cache) due to some database maintenance or reconfigure operations.
  2. SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'SQL Plans' cachestore (part of plan cache) due to some database maintenance or reconfigure operations.
  3. SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'Object Plans' cachestore (part of plan cache) due to some database maintenance or reconfigure operations.

It turns out there were multiple databases with the AutoClose setting turned on.

You can check your own database with this command:

SELECT DATABASEPROPERTYEX('DatabaseName','IsAutoClose')

Once we turned the setting off, the messages went away and performance improved. For further reading as to why auto close is a bad idea:

  • Worst Practice: Allowing AutoClose on SQL Server
  • SQL Server Best Practices: AutoClose should be off

The accepted answer states "Auto close on" is a likely culprit but doesn't state why and doesn't list other possibilities.

This is perfectly documented behaviour and the reasons you could be seeing that error message are listed on the Microsoft support site.

If you observe this error message on a somewhat regular basis it's likely because at that time every day the last connection to the database is closed and the database shuts down or it could be an agent job or scheduled job triggering one of the other conditions such as dropping a snapshot or running an sp_configure statement.