DBCC Commands or Database consistency Checker Commands has been with SQL Server from the its early ages itself. The article we would list the available DBCC commands listed using the DBCC HELP command. Many in this list is undocumented and is rarely used in practical scenarios. But these form the base for debugging complex problems. There is approximately-them.
DBCC activecursors [(SPID)]
DBCC addextendedproc (function_name, Dll_name)
DBCC addinstance (objectname, InstanceName)
DBCC adduserobject (name)
DBCC auditevent (EventClass, EventSubClass, Success, LoginName, RoleName, Dbusername, loginID)
DBCC Autopilot (typeid, dbid, TabID, indid, pages [, flag])
DBCC balancefactor (variance_percent)
DBCC Bufcount [(number_of_buffers)]
DBCC buffer ({' dbname ' | dbid} [, ObjID [, Number [, printopt={0|1|2}] [, dirty | io | kept | rlock | ioerr | ha Shed]])
DBCC bytes (startaddress, length)
DBCC Cachestats
DBCC Callfulltext
DBCC checkalloc [(' database_name ' [, NOINDEX | REPAIR]] [with no_infomsgs[, all_errormsgs][, Estimateonly]
DBCC checkcatalog [(' database_name ')] [with NO_INFOMSGS]
DBCC checkconstraints [(' Tab_name ' | tab_id | ' Constraint_name ' | CONSTRAINT_ID)] [with All_constraints | ALL_ERRORMSGS]
DBCC checkdb [(' database_name ' [, NOINDEX | REPAIR]] [with no_infomsgs[, all_errormsgs][, physical_only][, estimateonly][, DBCC TABLOCK]
DBCC Checkdbts (dbid, Newtimestamp)]
DBCC CheckFilegroup [([{' Filegroup_name ' | filegroup_id}] [, NOINDEX])] [with no_infomsgs[, all_errormsgs][, physical_only][, estimateonly][, TABLOCK]]
DBCC checkident (' table_name ' [, {noreseed | {reseed [, New_reseed_value]}} ] )
DBCC checkprimaryfile ({' FileName '} [, opt={0|1|2|3}])
DBCC checktable (' table_name ' [, {NOINDEX | index_id | REPAIR}]) [with no_infomsgs[, all_errormsgs][, physical_only][, estimateonly][, TABLOCK]]
DBCC cleantable (' database_name ' |database_id, ' table_name ' |table_id, [batch_size])
DBCC CacheProfile [({ActionId} [, bucketID])
DBCC clearspacecaches (' database_name ' |database_id, ' table_name ' |table_id, ' index_name ' |index_id)
DBCC collectstats (on | off)
DBCC concurrencyviolation (Reset | display | startlog | stoplog)
DBCC Config
DBCC cursorstats ([spid [, ' clear ']])
DBCC dbinfo [(' dbname ')]
DBCC dbrecover (dbname [, Ignoreerrors])
DBCC dbreindex (' table_name ' [, index_name [, FillFactor]]) [with NO_INFOMSGS]
DBCC dbreindexall (db_name/db_id, Type_bitmap)
DBCC dbrepair (' dbname ', dropdb [, Noinit])
DBCC dbtable [({' dbname ' | dbid})]
DBCC DebugBreak
DBCC deleteinstance (objectname, InstanceName)
DBCC des [({' dbname ' | dbid} [, {' objname ' | objid}])]
DBCC detachdb [(' dbname ')]
DBCC dropcleanbuffers
DBCC Dropextendedproc (function_name)
DBCC dropuserobject (' object_name ')
DBCC dumptrigger ({' break ', {0 | 1}} | ' DISPLAY ' | {' SET ', exception_number} | {' CLEAR ', Exception_number})
DBCC errorlog
DBCC Extentinfo [({' database_name ' | dbid | 0} [, {' table_name ' | table_id} [, {' index_name ' | index_id |-1}]])
DBCC Fileheader [({' dbname ' | dbid} [, Fileid])
DBCC fixallocation [({' ADD ' | ' REMOVE '}, {' PAGE ' | ' Singlepage ' | ' EXTENT ' | ' Mixedextent '}, FileNum, Pagenum [, Objectid, Indid])
DBCC Flush (' data ' | ' Log ', dbid)
DBCC flushprocindb (database)
DBCC free dll_name (free)
DBCC Freeproccache
DBCC freeze_io (db)
DBCC GetValue (name)
DBCC help ('DBCC_command ' | ‘?‘)
DBCC icecapquery (' dbname ', Stored_proc_name [, #_times_to_icecap ( -1 infinite, 0 turns off)]) use 'dbcc Icecapquery (printlist) ' to-see list of SP ' s to profile. Use the 'DBCCicecapquery (Icecapall) ' To profiles all SP ' s.
DBCC incrementinstance (objectname, CounterName, InstanceName, value)
DBCC Ind ({' dbname ' | dbid}, {' ObjName ' | objid}, {indid | 0 |-1 |-2})
DBCC indexdefrag ({dbid | dbname | 0}, {TableID | tablename}, {indid | indname})
DBCC inputbuffer (spid)
DBCC invalidate_textptr (TEXTPTR)
DBCC Invalidate_textptr_objid (ObjID)
DBCC iotrace ({' dbname ' | dbid | 0 |-1}, {Fileid | 0}, bufsize, [{numios |-1} [, {timeout (sec) |-1} [, printopt={0 | 1}]] )
DBCC Latch (address [, ' Owners '] [, ' Stackdumps '])
DBCC Lock ([{' Dumptable ' | ' Dumpstats ' | ' Resetstats ' | ' HASH '}]| [{' Stallreporttheshold ', Stallthreshold}])
DBCC lockobjectschema (' object_name ')
DBCC log ([dbid[,{0|1|2|3|4}[,[' LSN ', ' [0x]x:y:z ']|[') Numrecs ', num]| [' Xdesid ', ' x:y ']| [' Extent ', ' x:y ']| [' PageID ', ' x:y ']| [' ObjID ', {x, ' Y '}]| [' Logrecs ', {' Lop ' |op}...]| [' Output ', x,[' filename ', ' x ']] ...)
DBCC Loginfo [({' database_name ' | dbid})]
DBCC matview ({' PERSIST ' | ' Endpersist ' | ' Free ' | ' Use ' | ' Enduse '})
DBCC memobjlist [(Memory object)]
DBCC Memorymap
DBCC Memorystatus
DBCC Memospy
DBCC memusage ([IDS | NAMES], [number of rows to output])
DBCC monitorevents (' sink ' [, ' filter-expression '])
DBCC newalloc-please use Checkalloc instead
DBCC no_textptr (table_id, Max_inline)
DBCC Opentran [({' dbname ' | dbid})] [with TABLERESULTS[,NO_INFOMSGS]]
DBCC outputbuffer (spid)
DBCC page ({' dbname ' | dbid}, FileNum, Pagenum [, printopt={0|1|2|3}] [, cache={0|1}])
DBCC Perflog
DBCC Perfmon
DBCC pglinkage (dbid, Startfile, STARTPG, number, printopt={0|1|2}, TargetFile, TARGETPG, order={1|0})
DBCC pintable (database_id, table_id)
DBCC procbuf [({' dbname ' | dbid}[, {' objname ' | objid}[, nbufs[, printopt = {0 | 1}]])]
DBCC Proccache
DBCC prtipage (dbid, ObjID, IndexID [, [{{level, 0} | {FileNum, pagenum}}] [, Printopt]])
DBCC PSS [(uid[, spid[, printopt = {1 | 0}]])
DBCC readpage ({dbid, ' dbname '}, Fileid, PageID, formatstr [, printopt = {0 | 1}])
DBCC Rebuild_log (dbname [, filename])
DBCC renamecolumn (object_name, Old_name, new_name)
DBCC Resource
DBCC row_lock (dbid, TableID, set)-Not Needed
DBCC ruleoff ({rulenum | rulestring} [, {rulenum | rulestring}]+)
DBCC ruleon (rulenum | rulestring} [, {rulenum | rulestring}]+)
DBCC setcpuweight (weight)
DBCC setinstance (objectname, CounterName, InstanceName, value)
DBCC setioweight (weight)
DBCC show_statistics (' table_name ', ' target_name ')
DBCC showcontig (table_id | table_name [, INDEX_ID | index_name] [with FAST, all_indexes, tableresults [, All_leve LS]])
DBCC showdbaffinity
DBCC showfilestats [(File_num)]
DBCC Showoffrules
DBCC Showonrules
DBCC showtableaffinity (table)
DBCC showtext (' dbname ', {textpointer | {Fileid, PageID, SlotID [, Option]}})
DBCC showweights
DBCC shrinkdatabase ({dbid | ' DBName '}, [Freespace_percentage [, {notruncate | TRUNCATEONLY}])
DBCC SHRINKDB is no longer supported. Please use Shrinkdatabase instead
DBCC shrinkfile ({fileid | ' filename '}, [Compress_size [, {notruncate | truncateonly | Emptyfile}])
DBCC Sqlmgrstats
DBCC sqlperf (logspace) ({iostats | Lrustats | Netstats | Rastats [, CLEAR]} | {THREADS} | {logspace})
DBCC Stackdump [({uid[, spid[, ecid]} | {threadId, ' threadId '}] )]
DBCC tab (dbid, ObjID)
DBCC Tape_control {' Query ' | ' Release '}[, (' \\.\tape<n> ')]
DBCC Tec [(uid[, spid[, Ecid])]
DBCC Textall [({' database_name ' |database_id}[, ' full ' | FAST])]
DBCC textalloc ({' table_name ' |table_id}[, ' full ' | FAST])
DBCC thaw_io (db)
DBCC Traceoff [(Tracenum [, Tracenum ...])]
DBCC Traceon [(Tracenum [, Tracenum ...])]
DBCC tracestatus (trace# [, ... trace#])
DBCC unpintable (dbid, table_id)
DBCC updateusage ({' database_name ' | 0} [, ' table_name ' [, index_id]]) [with [NO_INFOMSGS] [,] count_rows]
DBCC upgradedb (db)
DBCC usagegovernor (command, value)
DBCC Useplan [(Number_of_plan)]
DBCC useroptions
DBCC Wakeup (SPID)
DBCC writepage ({dbid, ' dbname '}, Fileid, PageID, offset, length, data)
Note: DONOT use DBCC commands on Production or live database without consulting your database ADM Inistrators.
List Available DBCC Commands