DBAtlas · Database operations atlas

Integrity check (DBCC CHECKDB)

SQL ServerMaintenance

Command

-- Full integrity check:
DBCC CHECKDB (N'Customer') WITH NO_INFOMSGS, ALL_ERRORMSGS;

-- Lighter on large databases (physical consistency):
DBCC CHECKDB (N'Customer') WITH PHYSICAL_ONLY, NO_INFOMSGS;

What it does

Checks the physical and logical integrity of the database (page structures, allocation, index consistency) and reports corruption.

When to use it

In regular maintenance (weekly), on suspected hardware/IO problems, after 823/824 errors.

Caution

Uses heavy I/O and tempdb; run it in a maintenance window. If errors are found, REPAIR_ALLOW_DATA_LOSS must be the LAST resort and CAUSES DATA LOSS; consider restoring from a good backup first. PHYSICAL_ONLY is faster but skips logical checks.

Open in DBAtlas →

Related