Database Consistency Check, abbreviated as DBCC commands are perhaps the best friends of any DBA. Following are some of the most common DBCC commands that can be found in almost all the script banks:
- CHECKDB
- CHECKIDENT
- CHECKALLOC
- CHECKTABLE
- TRACEON
- TRACEOFF
- SHOWCONTIG
I am poor at remembering the syntax of these commands and therefore take occasional help of the SQL Server Books On Line (BOL) to get a hint on the parameters that a particular DBCC command uses. However, there are cases when one is working directly off the development or quality assurance servers, which generally do not have BOL installed. In such cases, the easiest way to obtain help for the DBCC commands is to use another, obvious DBCC command – DBCC HELP!
Here’s a quick example:
DBCC HELP (‘CHECKIDENT’)
GO
Running the above returns the following text, which is essentially the syntax help for DBCC CHECKIDENT:
dbcc CHECKIDENT
(
‘table_name’
[ , { NORESEED
| { RESEED [ , new_reseed_value ] }
} ]
)
[ WITH NO_INFOMSGS ]
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
So the next time you are stuck with the syntax for a DBCC command, ask DBCC for HELP before reaching out for the BOL.
(The catch: To the best of my knowledge DBCC HELP only works for the documented DBCC commands, similar to the BOL.)
Until we meet next time,