Monthly Archives: January 2018

Last known good CHECKDB…for ALL your databases!

This morning Wednesday I walk into the office and immediately hear that CHECKDB is the source of issues on one of the servers and is the reason behind some errors that have been happening. While I don’t think this is the case (it might look like it on the surface but there is something else that is happening that is the actual cause) I also wanted to find out what CHECKDB was running at the time the errors occurred.

I needed information on when CHECKDB ran for each database. When you look for what you can run to find when CHECKDB was last run you find this blog post and also this blog post on grabbing this info. While these were very informative, they were for one database at a time. I need this for all the databases so I can try to not only find out when each one ran, but also use these time stamps to figure out the duration.

I took the code from Jason’s post and made a few changes, running this for all the database with sp_MSForEachDB.

The results gave me some good information to go on – the database where the errors occurred was not the same database where CHECKDB was running during that time frame. There were also some FlushCache messages in the log – some suspect that this is also tied to the errors that are happening. Since all this ties back to NHibernate code, I suspect something else is going on and further digging is needed.

Situation developing. 🙂