List Available DBCC Commands

DBCC Commands or Database Consistency Checker commands have been with SQL Server from its early ages itself. In this article we would list the available DBCC commands listed using the DBCC Help command. Many in this list are undocumented and  are rarely used in practical scenarios. But these form the base for debugging complex problems. There are approximately 130 of  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 | hashed ]]])

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 ‘DBCCicecapquery (icecapall)‘ to profile 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_LEVELS]])

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: Please DONOT use DBCC commands on Production or live database without consulting your Database administrators.

原文地址:https://www.cnblogs.com/lhdz_bj/p/9574527.html

时间: 2024-10-12 07:16:52

List Available DBCC Commands的相关文章

几个未公开的 DBCC 命令

http://blog.csdn.net/CathySun118/article/category/538610 https://ask.hellobi.com/blog/lyhabc/1612 1. DBCC BUFFER This command can be used to display buffer headers and pages from the buffer cache.Syntax: dbcc buffer ([dbid|dbname] [,objid|objname] [,

使用Event Message 对 Package 进行Troubleshoot

发现一个Package Job运行异常,该Package从开始执行到结束,一直处于僵死状态.从 Job Activity Monitor中看到该Job一直处于运行状态,但是,DW中没有执行任何Query 操作.从Operation的Event Message看到 :Package_Path 是 \Package.EventHandlers[OnPreValidate]\Stop running Jobs 事件处理程序 OnPreValidate 的官方定义是: OnPreValidate:The

SQL Server 2008性能故障排查(一)——概论

原文:SQL Server 2008性能故障排查(一)--概论 备注:本人花了大量下班时间翻译,绝无抄袭,允许转载,但请注明出处.由于篇幅长,无法一篇博文全部说完,同时也没那么快全部翻译完,所以按章节发布.由于本人水平有限,翻译结果肯定存在问题,为了不造成误导,在每篇结尾处都附上原文,供大家参考,也希望能指出我的问题,以便改进.谢谢. 另外,本文写给稍微有经验的数据库开发人员或者DBA看,初学者可能会看不懂.在此请见谅 作者:Sunil Agarwal, Boris Baryshnikov, K

DBCC - Undocumented commands

These commands may affect system performance and/or force table-level locks.There is no guarantee these commands will remain available in any future release of SQL server. DBCC activecursors [(spid)] DBCC addextendedproc (function_name, dll_name) DBC

DBCC

一:DBCC 1:什么是DBCC 我不是教学老师,我也说不到没有任何无懈可击的定义,全名:Database Console Commands.顾名思义“数据库控制台命令”,说到“控制台“, 我第一反应就是chrome的开发者工具,不知道你的第一反应会是怎样?开发者工具中,只要javascript能认的语法,你都可以在控制台键入...同 样的道理sqlserver能认的也是一样. 2:DBCC到底有多少个命令  你应该知道,凡是控制台,大多都会提供一个help命令,比如cmd界面,又或者是mong

Sql Server之旅——第五站 确实不得不说的DBCC命令

今天研发中心办年会,晚上就是各自部门聚餐了,我个人喜欢喝干红,在干红中你可以体味到那种酸甜苦辣...人生何尝不是这样呢???正好 ceo从美国带了干红回来,然后我就顺道开心的过了把瘾....一个字...爽....喝着有点多...到现在头还疼....回来地铁上想这个 周末忙着找房子,书一点都没看,也没在博客上接着忽悠,想起了上篇博客有个哥们说普及普及DBCC,虽然有点迷迷糊糊的...看能不能写出点新 花样....不管学什么语言,还是数据库,你得看的比人家深一层...最可悲的就是停留的在表层,这样每

DBCC CHECKDB

DBCC CHECKDB 算是管理员们最常用的命令也是必须要知道的命令了.定期的检查及问题的修复都是比较重要的!!下面介绍一下 DBCC CHECKDB 的一些基本用法. DBCC CHECKDB 完成两项任务: 检查数据库里有没有损坏发生. 尽力修复数据库损坏,使数据库能够被重新正常访问. DBCC CHECK 做了些什么: 检查一些关键的系统表 对数据库运行DBCC CHECKALLOC 对数据库运行DBCC CHECKCATALOG 验证数据库中每个索引视图的内容 验证数据库中servic

Laravel artisan commands

使用php artisan list 可以看到artisan的所有命令以及选项. 当然你也可以在此基础上扩展自己的命令. 1. key 1.1 key:generate 这是一个加密秘钥,用于保证安全性,在发布程序的时候需要操作这一步骤. 2. generate 2.1 generate:controller 这样就在controllers目录下面添加了一个控制器文件testController.php,该控制符合CRUD(create, receive, update, delete) 该文件

vim --Filter commands

命令也被称作是motion :help ! Filter commands 信息过滤 (filter) !==>tell vim to performing a filter operation !5G -> 从光标下向下5行执行过滤程序 (tell vim to start filter under cursor and go down 5 lines) :.,.+4! :10,15!sort -> 只在文件的第10行到第15行之间执行 (sort between line 10 to