Share via

DBCC CHECKDB Question

Chaitanya Kiran 841 Reputation points
2022-02-27T18:58:12.47+00:00

Does DBCC CHECKDB read pages from memory or from source db on disk?

SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories

0 comments No comments

4 answers

Sort by: Most helpful
  1. YufeiShao-msft 7,156 Reputation points
    2022-02-28T06:46:23.047+00:00

    Hi @Chaitanya Kiran ,

    DBCC CHECKDB use database snapshots, when DBCC CHECKDB reads a page in the context of the database snapshot, that page must be read from the source database on disk, and database snapshots use NTFS sparse-file techology
    https://www.sqlskills.com/blogs/paul/checkdb-from-every-angle-complete-description-of-all-checkdb-stages/

    -------------

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?

    1 person found this answer helpful.

  2. Anonymous
    2022-07-29T14:13:15.17+00:00

    After executing DBCC checkdb , I have got the following errors in one of my DB. Any solution please

    Msg 5901, Level 16, State 1, Line 1
    One or more recovery units belonging to database 'xxx' failed to generate a checkpoint. This is typically caused by lack of system resources such as disk or memory, or in some cases due to database corruption. Examine previous entries in the error log for more detailed information on this failure.
    Msg 1823, Level 16, State 2, Line 1
    A database snapshot cannot be created because it failed to start.
    Msg 1823, Level 16, State 8, Line 1
    A database snapshot cannot be created because it failed to start.
    Msg 7928, Level 16, State 1, Line 1
    The database snapshot for online checks could not be created. Either the reason is given in a previous error or one of the underlying volumes does not support sparse files or alternate streams. Attempting to get exclusive access to run checks offline.
    DBCC results for 'xxx'.
    DBCC CHECKDB will not check SQL Server catalog or Service Broker consistency because a database snapshot could not be created or because WITH TABLOCK was specified.
    DBCC results for 'sys.sysrscols'.

    Was this answer helpful?


  3. Shashank Singh 6,251 Reputation points
    2022-03-01T13:02:29.003+00:00

    It reads from disk ( which is snapshot basically like Erland pointed) but the checkdb is performed in memory.

    Was this answer helpful?


  4. Erland Sommarskog 134.7K Reputation points MVP Volunteer Moderator
    2022-02-27T19:48:40.743+00:00

    It reads from disk. More precisely, it reads from a hidden database snapshot. So when DBCC CHECKDB starts, it creates a database snapshot, which is a sparse file (that's a Windows feature) to get a consistent view of the database.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.