DBCC CHECKDB

  • I have a question.

    Does DBCC CHECKDB checks only the page (allocation and consistency checks) in the data file or does it ever tries to check the consistency in the log file.(like failure during recovery and database in suspect).

  • It never checks the log file - there isn't anything in SQL Server that you can run that will check the log file in the same way as DBCC CHECKDB checks the data files.

    Paul Randal
    CEO, SQLskills.com: Check out SQLskills online training!
    Blog:www.SQLskills.com/blogs/paul Twitter: @PaulRandal
    SQL MVP, Microsoft RD, Contributing Editor of TechNet Magazine
    Author of DBCC CHECKDB/repair (and other Storage Engine) code of SQL Server 2005

  • Thanks .

    What i understand that by default in sql 2005 it creates a snapshot and then runs the checkdb on the snapshot db increasing the concurreny and reducing the lock contention.

    I think in SQL 2000 , there is no concept of snapshot, then does it locks all objects at the time of CHECKDB or the objects is locked when it is checked for the consistency. So, if I have a TB DB which is taking 3-4 hours and some transaction has modified those pages , will it track and then rescans them or it will not be detected and only in the next run of the CHECKDB they will be checked.

    I hope I am able to put forward my question correctly.

  • Nope - it doesn't take locks in 2000 either and your description of the algorithm is way off - it scans the transaction log for changes and reconciles them with what it read from the pages (I wrote the code). See the first part of CHECKDB From Every Angle: Complete description of all CHECKDB stages for details.

    Paul Randal
    CEO, SQLskills.com: Check out SQLskills online training!
    Blog:www.SQLskills.com/blogs/paul Twitter: @PaulRandal
    SQL MVP, Microsoft RD, Contributing Editor of TechNet Magazine
    Author of DBCC CHECKDB/repair (and other Storage Engine) code of SQL Server 2005

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply