Finding the last successful CHECKDB

One very important part of your SQL Server maintenance procedure should be running consistency checks on a regular basis using CHECKDB. Not only does CHECKDB check the health of important internal pages of your database like PFS, GAM, IAM and many more, it also check for errors in your data pages (and it does a lot more than just checking pages!). As you – hopefully – know, running CHECKDB is really important to make sure your database is consistent and uncorrupted.

There are however scenarios where you have to manage a database and you are not sure when, or if, CHECKDB completed successfully. Thankfully we can find the date and time the last successful CHECKDB completed, though it isn’t as easy as it should be…

Undocumented fun

What I mean with finding the last successful CHECKDB date/time not being easy is that we need to use an undocumented DBCC command to get that data back from the database. Undocumented usually means fun, so let’s get started!

The information we are after is stored in the boot page of a database.
Every database has one boot page and it is always in the same location, the 9th page in the first file of the database. The boot page stores important information about the database like the database name, database creation date, the compatibility of the database and much more interesting stuff. It also contains the date and time of the last successful CHECKDB that has ran on that specific database!

When we are talking about getting information back from pages we need to use the undocumented DBCC PAGE command. To get the contents of the boot page we can execute the command below:

DBCC PAGE (databasename, 1, 9, 3) WITH TABLERESULTS

I’m using the WITH TABLERESULTS command so we do not have to set TF 3604 and TF 3605 to output the page information.

The information we are looking for is in the field ‘dbi_dbccLastKnownGood’ as that shows us the last successful CHECKDB run.

In this case I have ran the command against the AdventureWorks2012 database on my test machine:

checkdb_01

On my test machine CHECKDB had the last successful run on 2014-05-30 at 11:56.

If you see a date of ‘1900-01-01 00:00:00.000’ it means CHECKDB has either never ran, or – even worse – has never had a successful run.

I hope you noticed I used the word successful a lot in this article, this is because the date and time in the boot page is really the last successful run. If CHECKDB encountered an error during execution the ‘dbi_dbccLastKnownGood’ value will not change in the boot page!

91 comments to “Finding the last successful CHECKDB”

You can leave a reply or Trackback this post.
  1. Unquestionably believe that which you stated.
    Your favorite justification seemed to be on the web the
    easiest thing to be aware of. I say to you, I definitely get annoyed while people think
    about worries that they plainly don’t know
    about. You managed to hit the nail upon the top as well as defined out the whole thing without having side-effects ,
    people could take a signal. Will probably be back to get more.
    Thanks

  2. Hello! Would you mind if I share your blog with my myspace group?

    There’s a lot of people that I think would really appreciate your
    content. Please let me know. Thanks

  3. Thanks for some other excellent article. The place else could anyone get that kind of info in such a perfect method of writing?

    I have a presentation subsequent week, and I’m on the look for
    such info.

  4. An intriguing discussion is worth comment. I do
    think that you ought to publish more about
    this issue, it may not be a taboo subject but typically people don’t
    talk about such issues. To the next! Kind regards!!

  5. obviously like your website however you have to test the
    spelling on several of your posts. Several of them are rife with
    spelling issues and I find it very troublesome to inform the reality nevertheless I will definitely come
    back again.

  6. This is really fascinating, You’re a very professional blogger.
    I’ve joined your feed and stay up for in quest of extra of your excellent post.
    Additionally, I’ve shared your website in my social networks

  7. Hey There. I found your blog the usage of msn. That
    is a very well written article. I will make sure to bookmark it and return to
    read more of your helpful info. Thanks for the post.
    I’ll certainly comeback.

  8. With havin so much content do you ever run into any problems of plagorism or copyright infringement?
    My blog has a lot of completely unique content I’ve either written myself or outsourced but it seems a lot of it is popping it up all over the web without
    my permission. Do you know any methods to help protect against content from being stolen?
    I’d genuinely appreciate it.

  9. whoah this weblog is magnificent i like reading your articles.
    Keep up the good work! You recognize, a lot of people are hunting around for this info,
    you can help them greatly.

  10. you’re really a excellent webmaster. The site loading pace is amazing.

    It sort of feels that you’re doing any unique trick. Also, The contents are masterwork.
    you’ve done a excellent job in this topic!

  11. Please let me know if you’re looking for a article author for your site.
    You have some really good articles and I feel I would be a good asset.

    If you ever want to take some of the load off, I’d love to write some articles for your blog in exchange for a link back to mine.
    Please shoot me an email if interested. Regards!

  12. My relatives always say that I am killing my time here at net, but I
    know I am getting knowledge all the time by reading thes
    nice articles or reviews.

  13. I savour, lead to I found just what I was looking
    for. You have ended my four day lengthy hunt! God Bless you man.
    Have a great day. Bye

  14. whoah this blog is fantastic i love studying
    your posts. Keep up the great work! You already know, a lot of persons
    are hunting round for this information, you can help
    them greatly.

  15. magnificent post, very informative. I ponder why the other experts of this sector don’t realize this.
    You must proceed your writing. I’m confident, you’ve a huge readers’ base
    already!

  16. You could definitely see your skills within the work
    you write. The world hopes for more passionate writers like you who are not afraid to say how they believe.
    All the time go after your heart.

  17. First off I would like to say excellent blog! I had a quick question in which I’d like to ask if you do
    not mind. I was interested to find out how you center yourself and clear your thoughts prior to writing.
    I have had trouble clearing my mind in getting my ideas out there.
    I truly do enjoy writing however it just seems like the first 10
    to 15 minutes are generally lost just trying to figure
    out how to begin. Any suggestions or hints? Appreciate it!

  18. Hmm it appears like your blog ate my first comment (it was super long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog.
    I too am an aspiring blog blogger but I’m still new to everything.
    Do you have any helpful hints for novice blog writers?
    I’d certainly appreciate it.

  19. Heya! I’m at work browsing your blog from my
    new iphone! Just wanted to say I love reading your blog and look forward
    to all your posts! Carry on the superb work!

  20. wonderful put up, very informative. I wonder why the opposite experts
    of this sector do not realize this. You must proceed your writing.
    I am sure, you’ve a huge readers’ base already!

  21. Thanks a lot for sharing this with all people you really realize what
    you are speaking approximately! Bookmarked. Please also consult with my website =).

    We can have a hyperlink alternate agreement among us

  22. I have been exploring for a little bit for any high-quality articles or weblog posts on this kind of house .

    Exploring in Yahoo I ultimately stumbled upon this web site.
    Studying this information So i’m glad to exhibit that
    I’ve an incredibly excellent uncanny feeling I found out exactly what I
    needed. I such a lot certainly will make sure to don?t
    forget this site and provides it a look on a relentless
    basis.

  23. I do not know if it’s just me or if everybody
    else encountering issues with your blog. It looks like some of the written text in your posts
    are running off the screen. Can someone else please provide feedback and let
    me know if this is happening to them too? This might be a
    problem with my internet browser because I’ve
    had this happen previously. Appreciate it

  24. I got this website from my friend who told me on the topic of this web page and now
    this time I am browsing this site and reading very informative articles or reviews
    here.

  25. excellent publish, very informative. I ponder why the other specialists of
    this sector don’t notice this. You must continue your writing.
    I’m sure, you’ve a huge readers’ base already!

  26. Nice blog right here! Also your web site rather a lot up very fast!
    What host are you the use of? Can I get your associate link in your host?
    I desire my site loaded up as fast as yours lol

  27. magnificent points altogether, you just received a new reader.
    What would you recommend in regards to your publish
    that you made some days ago? Any certain?

  28. First off I would like to say great blog! I had a quick question in which I’d
    like to ask if you do not mind. I was interested to find out how
    you center yourself and clear your head prior to writing.
    I’ve had a tough time clearing my mind in getting my ideas
    out there. I do take pleasure in writing but it just seems like
    the first 10 to 15 minutes are lost simply just trying to figure
    out how to begin. Any ideas or hints? Cheers!

  29. You can certainly see your skills in the work you write. The world hopes for more passionate writers such as you who are not
    afraid to mention how they believe. All the time go after your heart.

  30. I was suggested this blog by means of my cousin. I am now not positive whether this put
    up is written through him as no one else realize such special about my difficulty.
    You’re wonderful! Thank you!

  31. interesting review. Moreover visit your site to recognise slot online.
    This website has received reputation right from agen slot deposit pulsa gambling online dating services
    in Negara sendiri. Right now there tend to be plenty of beautiful promos inside
    event you join at the moment.

  32. important review. Moreover visit your personal site to have enjoyment from slot.
    The actual web-site has received conclusion from the comfort
    of slot pulsa online gambling members in Negara sendiri.
    Right now there are actually loads of appealing promos just in case you join right now.

Write a Reply or Comment

Your email address will not be published.