DBCC CHECKDB AND REINDEX - Any Specific Execution Order

  • We perform 1. DBCC CHECKDB and 2. DBCC REINDEX every week-end.

    Is there any specific order we need to execute this command?

    Is it better to execute DBCC CHECKDB after DBCC REINDEXing?

  • DBCC CHECKDB checks the linkages and sizes of text, ntext, and image pages for each table, and the allocation of all the pages in the database.

    For each table in the database, DBCC CHECKDB checks that:

    Index and data pages are correctly linked.

    Indexes are in their proper sort order.

    So order can be DBCC Checkdb and DBCC Reindex

  • For each table in the database, DBCC CHECKDB checks that:

    Index and data pages are correctly linked.

    Indexes are in their proper sort order.

    So order can be DBCC Checkdb and DBCC Reindex [/i]

    CheckDB checks index and data pages linkage so does it make sense to execute CHECKDB after DBCC REINDEX?

  • I'd run it before. There's not much point in doing expensive maintenance on a database that's corrupt. If there's any corruption present, the reindex would probably throw errors anyway.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Gail,

    This is weekly maintenance plan and we run both DBCC command in the same job.

    What do you suggest to run first? CHECKDB OR REINDEX?

  • As I said above, I'd do checkDB first, as there's little point in trying to rebuild indexes of a database with corruption. Also, it's very likely that the index rebuild would fail if there's corruption present.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 6 posts - 1 through 5 (of 5 total)

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