Introduction
Today we understand the basic but important uses of some DBCC commands in SQL Server.
So what is DBCC?
Database Consistency Checker will help us to check the consistency of the database, this is also known as database console commands.
These commands are divided into the below categories.
- Maintenance
- Miscellaneous
- Informational
- Validation
Maintenance
This category includes commands for the tasks related to database, index, and filegroup, as shown below.
- CLEANTABLE
- DBREINDEX
- DROPCLEANBUFFERS
- FREEPROCCACHE
- INDEXDEFRAG,
- SHRINKDATABASE
- SHRINKFILE
- UPDATEUSAGE
Miscellaneous
This category includes commands for the tasks related to trace flag or DDL memory management, as shown below.
- HELP
- FLUSHAUTHCACHE
- TRACEOFF
- FREESESSIONCACHE
- TRACEON
- FREESYSTEMCACHE
- CLONEDATABASE
Informational
This category includes commands for tasks to collect or display different types of information, like below.
- INPUTBUFFER
- SHOWCONTIG
- OPENTRAN
- OUTPUTBUFFER
- PROCCACHE
- SHOW_STATISTICS
- SQLPERF
- TRACESTATUS
- USEROPTIONS
Validation
This category includes commands for the tasks to perform some kind of validation actions on the database, index, tables, etc., which I would say are more useful in certain ways, like below.
- CHECKALLOC
- CHECKCATALOG
- CHECKCONSTRAINTS
- CHECKDB
- CHECKFILEGROUP
- CHECKIDENT
- CHECKTABLE
So let's understand the basic but useful DBCC commands that we might not be familiar with but could help in many ways to solve our problem(s).
DBCC HELP
This command falls under the Miscellaneous category.
Syntax
- DBCC HELP ('?');
The above statement/command will return all the supported/available DBCC commands to the specific SQL Server version like on the below screen.

Note
Need sysadmin role to execute the above command.
Now we may be thinking of how to use the above commands. It's very simple, we will use the same HELP command, but with the parameter shown below.
Syntax
- DBCC HELP (checkident);
- GO
The above statement/command will return the complete syntax of "how to use the checkident command" like in the below screen.


Ashish RathodPosted Sep 23, 2020, 11:16 PM
Easy way to understand contents. Thanks for sharing!
Pankajkumar PatelPosted Sep 19, 2020, 12:22 AM
Contents are good.