Using DBCC and Trace Statements to Troubleshoot

DBCC stands for Database Consistency Checker. DBCC consists of a series of commands that perform a variety of functions on databases and database objects. DBCC commands are used to perform database and database object maintenance but also can be used to find errors—and in some cases, fix them. SQL Server also provides a series of trace flags that can be used to provide additional information about SQL Server such as the estimated and actual cost of a sort (trace flag 326). To turn a trace flag on for a single user connection, use the following syntax:

DBCC TRACEON(FLAG_NUMBER) 

For example, the following syntax would turn on trace flag 326:

DBCC TRACEON(326) 

To turn off a trace flag, use the ...

Get Microsoft® SQL Server™ 2000 DBA Survival Guide, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.