SQL Server Guide

What is DBCC CHECKDB? Complete Guide to SQL Server Database Checking

By Data Repair Pro Team  ·  June 2026  ·  8 min read

If you manage a SQL Server database, DBCC CHECKDB is one of the most important commands you will ever run. It is SQL Server's built-in database integrity checker — a diagnostic tool that examines every single page, row, and allocation structure in your database and reports any inconsistencies or corruption it finds.

In this guide, we will cover exactly what DBCC CHECKDB does, how to run it, how to interpret its output, and — most importantly — what to do when it finds errors.

What Does DBCC CHECKDB Do?

DBCC stands for Database Console Commands. CHECKDB specifically performs a comprehensive physical and logical consistency check of your entire database. Here is what it checks:

How to Run DBCC CHECKDB

The basic syntax to run DBCC CHECKDB against a database named MyDatabase is:

DBCC CHECKDB ('MyDatabase') WITH NO_INFOMSGS;

The WITH NO_INFOMSGS option suppresses informational messages and shows only errors, making the output much easier to read. To check the current database, you can simply use:

DBCC CHECKDB;
💡 Tip: Run DBCC CHECKDB during off-peak hours. On large databases (100+ GB), it can take hours and places a significant read load on the server.

Understanding the Output

DBCC CHECKDB output can look intimidating. Here is a quick guide to what the messages mean:

Clean Output (No Errors)

DBCC results for 'MyDatabase'.
CHECKDB found 0 allocation errors and 0 consistency errors in database 'MyDatabase'.

This is the result you want to see. Your database is healthy.

Error Output (Corruption Found)

Msg 8946, Level 16, State 12, Line 1
Table error: Allocation page (1:9) has invalid page header values. Run DBCC CHECKDB.
CHECKDB found 1 allocation errors and 0 consistency errors in database 'MyDatabase'.

Error messages include a message number (like 8946), a severity level, and a description of what is wrong. Severity level 16 indicates user-correctable errors.

Common DBCC CHECKDB Error Codes

Repair Options in DBCC CHECKDB

When DBCC CHECKDB finds errors, it recommends a repair level. There are three levels:

REPAIR_FAST

Performs minor, syntactic repairs only. Rarely useful in modern SQL Server versions.

REPAIR_REBUILD

Rebuilds indexes and performs repairs that don't involve data loss. This is the safest option and should be tried first.

ALTER DATABASE MyDatabase SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
DBCC CHECKDB ('MyDatabase', REPAIR_REBUILD);
ALTER DATABASE MyDatabase SET MULTI_USER;

REPAIR_ALLOW_DATA_LOSS

The most aggressive repair option. SQL Server will discard corrupted pages, which may result in lost rows. Use this only as a last resort when REPAIR_REBUILD fails.

ALTER DATABASE MyDatabase SET EMERGENCY;
ALTER DATABASE MyDatabase SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
DBCC CHECKDB ('MyDatabase', REPAIR_ALLOW_DATA_LOSS);
ALTER DATABASE MyDatabase SET MULTI_USER;
ALTER DATABASE MyDatabase SET ONLINE;
⚠️ Warning: Always create a full backup of your database before running any repair commands. Even REPAIR_REBUILD can, in rare cases, cause additional issues.

The Easier Way: Use Data Repair Pro

Manually running these T-SQL sequences is error-prone. A single typo in the wrong command can make a bad situation worse. Data Repair Pro automates the entire DBCC CHECKDB scan and repair sequence through a point-and-click interface — no command-line knowledge required.

Fix DBCC CHECKDB Errors Automatically

Connect to your SQL Server, select the database, click "Scan for Corruption", and then click "Execute Database Repair". Data Repair Pro handles all the mode switching, repair execution, and index rebuilding automatically.

Download Free Data Repair Tool

Best Practices for Running DBCC CHECKDB

Related articles: Fix SQL Error 823 · Fix SQL Error 824 · Recover SUSPECT Database