Sunday, October 26, 2014

How to know “the last time a DBCC CHECKDB was run without errors” in a Database

We all know the importance of DBCC CheckDB command in sql server. If data corruption occurred in a database and you want to know When was the last time DBCC CHECKDB reported no errors for the corrupted database.

If you have saved all CHECKDB results or the ERRORLOG files you can find it from there. 

But in case you have deleted these files the from where you will get to know the information about same???

Not to worry about this question as Along with CHECKDB reports and error log, SQL server saves information about the last time a DBCC CHECKDB was run without errors in the database also.

Let see how can we get that information:

I have a sample database TestVK for this post. Now to see the last known good information of TestVK database we will use dbcc command as below.

DBCC TRACEON(3604,-1)
DBCC DBINFO(TestVK)
DBCC TRACEOFF(3604,-1)




Go to Result and search for "LastKnownGood". You will see the output as below:

dbi_dbccLastKnownGood = 2014-10-27 10:20:33.833

So this is the last time when a DBCC CHECKDB was run without errors.

Thanks For Reading This Post!! 

No comments:

Post a Comment