Syntax
DBCC CHECKDB
[( 'database' | database_id | 0
[ , NOINDEX
{ REPAIR_ALLOW_DATA_LOSS | REPAIR_FAST | REPAIR_REBUILD }
)]
[WITH
{
[ALL_ERRORMSGS ][ , EXTENDED_LOGICAL_CHECKS ] [ , NO_INFOMSGS ] [ , TABLOCK ]
[, ESTIMATEONLY ] [ , { PHYSICAL_ONLY | DATA_PURITY } ]
[, MAXDOP = number_of_processors ]
}
]
Key:
NOINDEX - Skip intensive checks of nonclustered indexes for user tables.
REPAIR_ALLOW_DATA_LOSS - Try to repair all reported errors.
REPAIR_REBUILD - Perform all repairs that can be performed without risk of data loss.
ALL_ERRORMSGS - Return all reported errors per object, default = first 200 errors.
EXTENDED_LOGICAL_CHECKS - Perform logical consistency checks on an indexed view, XML indexes,
and spatial indexes, where present.
TABLOCK - Obtain locks instead of using an internal database snapshot.
this limits the checks that are performed.
ESTIMATEONLY - Display the estimated amount of tempdb space that would be required.
PHYSICAL_ONLY - Limits the checking to the integrity of the physical structure.
DATA_PURITY - Check the database for column values that are not valid or out-of-range.
MAXDOP - Override the max degree of parallelism configuration option of
sp_configure for the statement.
The MAXDOP can exceed the value configured with sp_configure. If MAXDOP exceeds the value configured with Resource Governor, the Database Engine uses the Resource Governor MAXDOP value, described in ALTER WORKLOAD GROUP (Transact-SQL).
All semantic rules used with the max degree of parallelism configuration option are applicable when you use the MAXDOP query hint. For more information, see Configure the max degree of parallelism Server Configuration Option. I
MAXDOP is set to zero then the server chooses the max degree of parallelism.
-- Check the current database.
DBCC CHECKDB;
GO
“There are moments when everything goes well; don’t be frightened, it won’t last” ~ Jules Renard
Brian Cryer How To - Run DBCC checkdb on each database (using cursors)