This procedure runs a DBCC CheckDB operation for an individual database. Minion.CheckDB is the procedure that creates and runs the actual DBCC CHECKDB statements for databases which meet the criteria stored in the settings table (Minion.CheckDBSettingsDB).

IMPORTANT: We HIGHLY recommend using Minion.CheckDBMaster for all of your integrity check operations, even when operating on a single database. Do not call Minion.CheckDB to perform integrity checks.

The Minion.CheckDBMaster procedure makes all the decisions on which databases to process, and what order they should be in. It’s certainly possible to call Minion.CheckDB manually, to process an individual database, but we instead recommend using the Minion.CheckDBMaster procedure (and just include the single database using the @Include parameter). First, it unifies your code, and therefore minimizes your effort. By calling the same procedure every time you reduce your learning curve and cut down on mistakes. Second, future functionality may move to the Minion.CheckDBMaster procedure; if you get used to using Minion.CheckDBMaster now, then things will always work as intended.

 

Name Type Description
@DBName nvarchar

Database name.

@Op varchar

Operation name.

 

Valid inputs:

CHECKDB

CHECKALLOC

@StmtOnly bit

Only generate CheckDB statements, instead of running them.

@ExecutionDateTime datetime

The date and time of the batch operation; this is passed in from the Minion.CheckDBMaster procedure.

 

Leave this NULL when running this stored procedure explicitly.

@Debug bit

Enable logging of special data to the debug tables.

 

For more information, see “Minion.CheckDBDebug”, “Minion.CheckDBDebugSnapshotCreate”, and “Minion.CheckDBDebugSnapshotThreads”.

@Thread tinyint

Internal use only.

Example execution 1

-- Generate DBCC CHECKDB statements for database DB2, as applicable:
EXEC [Minion].[CheckDB] 
	@DBName = 'DB2', 
	@Op = 'AUTO', 
	@StmtOnly = 1;

Example execution 2

-- Generate DBCC CHECKALLOC statements for database DB1:
EXEC [Minion].[CheckDB] 
	@DBName = 'DB1', 
	@Op = 'CHECKALLOC', 
	@StmtOnly = 1;