The Minion.CheckDBMaster procedure is the central procedure of Minion CheckDB. It uses the parameter and/or table data to make all the decisions on which databases to run CheckDB, and what order they should be in. This stored procedure calls either the Minion.CheckDB stored procedure, or the Minion.CheckDBCheckTable.

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.

In addition, Minion.CheckDBMaster performs extensive logging, runs configured pre- and postcode, enables and disables the status monitor job (which updates log files for Live Insight, providing percent complete for each CheckDB), and more.

In short, Minion.CheckDBMaster decides on, runs, or causes to run every feature in Minion CheckDB.
 

Name Type Description
@DBType varchar

The type of database.

 

Valid inputs:

System

User

@OpName varchar

Operation name. Default value is CHECKDB.

 

The AUTO option allows Minion CheckDB to choose the appropriate operation per database, based on settings in the Minion.CheckDBSettingsAutoThresholds table. For more information on this, see the section titled “How to: Configure Minion CheckDB Dynamic Thresholds”.

 

Using NULL allows the system to choose the appropriate settings from the Minion.CheckDBSettingsServer table.

 

Valid inputs:

CHECKDB

CHECKTABLE

CHECKALLOC

AUTO

NULL

@StmtOnly bit

Only generate CheckDB statements, instead of running them.

@ReadOnly tinyint

Readonly option; this decides whether or not to include ReadOnly databases in the operation, or to perform operations on only ReadOnly databases.

 

A value of 1 includes ReadOnly databases; 2 excludes ReadOnly databases; and 3 only includes ReadOnly databases.

 

Valid values:

1

2

3

@Schemas varchar

This allows you to limit the operations to just a single schema, or list of schemas. Without further filtering (using the Tables column), all objects in this/these schemas will be targeted.

 

Note that this places no limit on the database. For example: If you specify Schemas=’Minion’, and you have a “Minion” schema in multiple databases, MC will operate on the Minion schema across any database that has it.

 

@Schemas = NULL will run maintenance on all schemas.

 

@Schema will also accept a comma-delimited list of database names and LIKE expressions (e.g., ‘Minion, Test%, Bravo’).

@Tables varchar

This allows you to limit the operations to just a single table, or list of tables.

 

Note that this places no limit on the database. For example: If you specify Tables=’Minion’, and you have a “Minion” table in multiple databases, MC will operate on the Minion table across any database that has it.

 

@Tables = NULL will run maintenance on all tables (unless otherwise filtered, e.g., by the @Schemas parameter).

 

@Table will also accept a comma-delimited list of database names and LIKE expressions (e.g., ‘Minion, Test%, Bravo’).

@Include Varchar

Use @Include to run CheckDB on a specific list of databases, or databases that match a LIKE expression. Alternately, set @Include=’All’ or @Include=NULL to run maintenance on all databases.

 

If, during the last backup run, there were backups that failed, and you need to back them up now, just call this procedure with @Include = 'Missing'. The stored procedure will search the log for the backups that failed in the previous batch (for a given BackupType and DBType), and back them up now. Note that the BackupType and DBType must match the errored out backups.

 

Valid inputs:

NULL
Regex
Missing
<comma-separated list of DBs including wildcard searches containing '%'>

@Exclude varchar

Use @Exclude to skip backups for a specific list of databases, or databases that match a LIKE expression.

 

Examples of valid inputs include:

DBname

DBName1, DBname2, etc.

DBName%, YourDatabase, Archive%

@NumConcurrentProcesses tinyint

The number of concurrent processes to use for this operation.

 

This is the number of databases that will be processed simultaneously (CheckDB or CheckTable).

 

Default value is 3.

@DBInternalThreads tinyint

If CheckTable, this is the number of tables that will be processed in parallel.

@TestDateTime datetime

A “what if” parameter that allows you to see what schedule will be used at a certain date and time. This returns the settings from Minion.CheckDBSettingsServer that would be used at that date and time, and a list of databases (and their order) to be included in the batch.

 

IMPORTANT: To ONLY run the test, and not the actual operations, run with @StmtOnly = 1. For example: EXEC Minion.CheckDBMaster @StmtOnly = 1, @TestDateTime = '2016-09-28 18:00';

@TimeLimitInMins int

The time limit to impose on this opertion, in minutes.

@FailJobOnError bit

Cause the job to fail if an error is encountered. If an error is encountered, the rest of the batch will complete before the job is marked failed.

@FailJobOnWarning bit

Cause the job to fail if a warning is encountered. If a warning is encountered, the rest of the batch will complete before the job is marked failed.

@Debug bit

Enable logging of special data to the debug tables.

 

For more information, see “Minion.CheckDBDebug” and “Minion.CheckDBDebugLogDetails”.

Example Execution

-- Run DBCC CHECKDB for all user databases EXCEPT "TestRun" and those named like %Archive:
EXEC [Minion].[CheckDBMaster] 
    @DBType = 'User', 
    @OpName = 'CHECKDB', 
    @StmtOnly = 0,  
    @Exclude = '%Archive, TestRun';

Example Execution

-- Generate database integrity statements for all system databases: 
EXEC [Minion].[CheckDBMaster] 
    @DBType = 'System', 
    @OpName = 'AUTO', 
    @StmtOnly = 1;

Example Execution

-- Run DBCC CHECKDB for all user databases named like Minion%, allow 2 concurrent processes:
EXEC [Minion].[CheckDBMaster] 
    @DBType = 'User', 
    @OpName = 'CHECKDB', 
    @StmtOnly = 0,  
    @Include = 'Minion%',
    @NumConcurrentProcesses = 2;

Example Execution

-- Run database integrity check operations for all databases, allow 3 concurrent processes:
EXEC [Minion].[CheckDBMaster] 
    @DBType = 'User', 
    @OpName = 'AUTO', 
    @StmtOnly = 0,  
    @NumConcurrentProcesses = 3;