几个未公开的 DBCC 命令

44、探秘未公开的DBCC命令及函数 本文深入介绍了SQL Server中一些未公开的DBCC命令和函数,它们在数据库维护、性能管理以及系统调试中具有重要作用。文章详细说明了这些命令的使用方法、注意事项以及潜在风险,为数据库开发者和管理员提供了更灵活的工具选择。同时强调了这些未公开功能的危险性,建议在充分测试后再应用于生产环境。 阅读详情

几个未公开的 DBCC 命令

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] [,nbufs], [printopt])

where

 

  dbid|dbname   - database id|database name

  objid|objname - object id|object name

  nbufs         - number of buffers to examine

  printopt      - print option

                  0 - print out only the buffer header and page header

                      (default)

                  1 - print out each row separately and the offset table

                  2 - print out each row as a whole and the offset table
 

This is the example:

DBCC TRACEON (3604)

dbcc buffer(master,'sysobjects')
 

2. DBCC BYTES

This command can be used to dump out bytes from a specific address.

Syntax:

dbcc bytes ( startaddress, length )

where

 

  startaddress  - starting address to dump 

  length         - number of bytes to dump
 

This is the example:

DBCC TRACEON (3604)

dbcc bytes (10000000, 100)
 

3. DBCC DBINFO

Displays DBINFO structure for the specified database.

Syntax:

DBCC DBINFO [( dbname )]

where

 

  dbname - is the database name.
 

This is the example:

DBCC TRACEON (3604)

DBCC DBINFO (master)
 

4. DBCC DBTABLE

This command displays the contents of the DBTABLE structure.

Syntax:

DBCC DBTABLE ({dbid|dbname})

where

 

  dbid|dbname  - database name or database ID
 

This is the example:

DBCC TRACEON (3604)

DBCC DBTABLE (master)
 

The DBTABLE structure has an output parameter called dbt_open. This parameter keeps track of how many users are in the database.

Look at here for more details:
FIX: Database Usage Count Does Not Return to Zero

5. DBCC DES

Prints the contents of the specified DES (descriptor).

Syntax:

dbcc des [( [dbid|dbname] [,objid|objname] )]

where

 

dbid|dbname   - database id|database name.

objid|objname - object id|object name
 

This is the example:

DBCC TRACEON (3604)

DBCC DES
 

6. DBCC HELP

DBCC HELP returns syntax information for the specified DBCC statement. In comparison with DBCC HELP command in version 6.5, it returns syntax information only for the documented DBCC commands.

Syntax:

DBCC HELP ('dbcc_statement' | @dbcc_statement_var | '?')

This is the example:

DBCC TRACEON (3604)

DECLARE @dbcc_stmt sysname

SELECT @dbcc_stmt = 'CHECKTABLE'

DBCC HELP (@dbcc_stmt)
 

7. DBCC IND

Shows all pages in use by indexes of the specified table.

Syntax:

dbcc ind( dbid|dbname, objid|objname, printopt = {-2|-1|0|1|2|3} )

where

 

  dbid|dbname   - database id|database name.

  objid|objname - object id|object name

  printopt      - print option
 

There is change in this command in how it is used in SQL Server 7.0, in that the printopt parameter is now no longer optional.

This is the example:

DBCC TRACEON (3604)

DBCC IND (master, sysobjects, 0)
 

8. DBCC log

This command is used to view the transaction log for the specified database.

Syntax:

DBCC log ( {dbid|dbname}, [, type={-1|0|1|2|3|4}] )

PARAMETERS:

   Dbid or dbname - Enter either the dbid or the name of the database

                    in question.

 

      type - is the type of output:

 

      0 - minimum information (operation, context, transaction id)

 

      1 - more information (plus flags, tags, row length, description)

 

      2 - very detailed information (plus object name, index name,

          page id, slot id)

 

      3 - full information about each operation

 

      4 - full information about each operation plus hexadecimal dump

          of the current transaction log's row.

 

     -1 - full information about each operation plus hexadecimal dump

          of the current transaction log's row, plus Checkpoint Begin,

          DB Version, Max XDESID

 

by default type = 0
 

To view the transaction log for the master database, run the following command:

DBCC log (master)

9. DBCC PAGE

You can use this command to view the data page structure.

Syntax:

DBCC PAGE ({dbid|dbname}, pagenum [,print option] [,cache] [,logical])

PARAMETERS:

   Dbid or dbname - Enter either the dbid or the name of the database

                    in question.

 

   Pagenum - Enter the page number of the SQL Server page that is to

             be examined.

 

   Print option - (Optional) Print option can be either 0, 1, or 2.

 

                  0 - (Default) This option causes DBCC PAGE to print

                      out only the page header information.

                  1 - This option causes DBCC PAGE to print out the

                      page header information, each row of information

                      from the page, and the page's offset table. Each

                      of the rows printed out will be separated from

                      each other.

                  2 - This option is the same as option 1, except it

                      prints the page rows as a single block of

                      information rather than separating the

                      individual rows. The offset and header will also

                      be displayed.

 

   Cache - (Optional) This parameter allows either a 1 or a 0 to be

           entered.

           0 - This option causes DBCC PAGE to retrieve the page

               number from disk rather than checking to see if it is

               in cache.

           1 - (Default) This option takes the page from cache if it

               is in cache rather than getting it from disk only.

 

   Logical - (Optional) This parameter is for use if the page number

             that is to be retrieved is a virtual page rather then a

             logical page. It can be either 0 or 1.

 

             0 - If the page is to be a virtual page number.

             1 - (Default) If the page is the logical page number.
 

This is the example:

DBCC TRACEON (3604)

DBCC PAGE (master, 1, 1)
 

Look at here for more details:
Data page structure in MS SQL 6.5

10. DBCC procbuf

This command displays procedure buffer headers and stored procedure headers from the procedure cache.

Syntax:

DBCC procbuf( [dbid|dbname], [objid|objname], [nbufs], [printopt = {0|1}] )

where

 

  dbid|dbname   - database id|database name.

  objid|objname - object id|object name

  nbufs         - number of buffers to print   

  printopt - print option

             (0  print out only the proc buff and proc header (default) 

              1  print out proc buff, proc header and contents of buffer)
 

This is the example:

DBCC TRACEON (3604)

DBCC procbuf(master,'sp_help',1,0)
 

11. DBCC prtipage

This command prints the page number pointed to by each row on the specified index page.

Syntax:

DBCC prtipage( dbid, objid, indexid, indexpage )

where

 

  dbid      - database ID 

  objid     - object ID 

  indexid   - index ID 

  indexpage - the logical page number of the index page to dump
 

This is the example:

DBCC TRACEON (3604)

DECLARE @dbid int, @objectid int

SELECT @dbid = DB_ID('master')

SELECT @objectid = object_id('sysobjects')

DBCC prtipage(@dbid,@objectid,1,0)
 

12. DBCC pss

This command shows info about processes currently connected to the server.

Syntax:

DBCC pss( suid, spid, printopt = { 1 | 0 } )

where

 

  suid     - server user ID    

  spid     - server process ID   

  printopt - print option

             (0  standard output,

              1  all open DES's and current sequence tree)
 

This is the example:

DBCC TRACEON (3604)

dbcc pss
 

13. DBCC resource

This command shows the server's level RESOURCE, PERFMON and DS_CONFIG information. RESOURCE shows addresses of various data structures used by the server. PERFMON structure contains master..spt_monitor field info. DS_CONFIG structure contains master..syscurconfigs field information.

Syntax:

DBCC resource

This is the example:

DBCC TRACEON (3604)

DBCC resource
 

14. DBCC TAB

You can use the following undocumented command to view the data pages structure (in comparison with DBCC PAGE, this command will return information about all data pages for viewed table, not only for particular number).

Syntax:

DBCC tab (dbid, objid)

where

 

  dbid  - is the database id

  objid - is the table id
 

This is the example:

DBCC TRACEON (3604)

DECLARE @dbid int, @objectid int

SELECT @dbid = DB_ID('master')

SELECT @objectid = object_id('sysdatabases')

DBCC TAB (@dbid,@objectid)
 


本文来自优快云博客,转载请标明出处:http://blog.youkuaiyun.com/CathySun118/archive/2009/06/12/4263208.aspx

SQLServer Log数据库查看器 查看SQL Server Log数据库,查看日志数据 查看SQL Server Log数据库,查看日志数据 立即下载

相关推荐

用sql语句dbcclog查看SQLServer数据库的事务日志[定义].pdf

用sql语句dbcclog查看SQLServer数据库的事务日志[定义].pdf

用sql语句查看SQL Server 数据库的事务日志

1)用系统函数select   *   from fn_dblog(null,null)   2)用DBCCdbcc log(dbname,4)       --(n=0,1,2,3,4)1 - 更多信息plus flags, tags, row length2 - 非常详细的信息plus object name, index name,page id, slot id

Mobidogs Blog 3273

Unity动画状态机实战:Trigger和Bool参数到底怎么选?附5个常见场景解析

本文深入解析Unity动画状态机中Trigger和Bool参数的核心差异与应用场景。通过对比两者在描述瞬时事件与持续状态上的本质区别,并结合角色移动、攻击连招、跳跃落地、受击死亡及环境交互等5个实战场景,提供了清晰的选择逻辑与避坑指南,帮助开发者构建更健壮、易维护的动画逻辑。

weixin_29009501的博客 120

DBCC 查看日志

1.  DBCC LOGINFO 2.  DBCC LOG([,{0|1|2|3|4}])         0 - Basic Log Information (default)         1 - Lengthy Info         2 - Very Length Info         3 - Detailed         4 - Full

duanbeibei的专栏 2767

Windows系统的Mamba环境配置详细教程(状态空间模型)

causal_conv1d也是安装mamba的依赖必须库。安装完成后,通过pip list可以查看到安装的库。Triton是安装mamba的依赖,需要先安装。上述工作准备好后,按下面步骤安装。直接根据离线文件安装即可。是自己的虚拟环境名字。

2301_77831163的博客 3677

AD20 Channel-Offset Error 解决办法

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录前言AD20 PCB相同电路模块ROOM格式复用时出现 Channel-Offset Error 解决办法一、问题现象二、解决办法 前言 AD20 PCB相同电路模块ROOM格式复用时出现 Channel-Offset Error 解决办法 一、问题现象 我们经常在使用Room格式快速布局相同模块电路时出现以下问题, 二、解决办法 相同模块电路PCB布局复制的过程网上有很多,这里不再做赘述,步骤都差不多,只说问题根源; 1:.

m0_47201213的博客 7628

虚拟日志文件剖析(DBCC LOGINFO )

每一个数据库至少有一个日志文件,无论为事务日志定义多个少物理文件,SQL Server均视为一个连续的文件。该事务日志文件实际上由一系列的虚拟日志文件VLF来管理。虚拟日志文件的大小由SQL Server的总日志文件的大小决定。虚拟日志文件的物理结构图如下所示: 当该日志文件收缩时,日志文件末端的未使用的VLF可以被删除。 在SQL server2000中,日志文件仅可以从日志文件的尾部收

6536

Advanced Installer打包避坑指南:如何正确配置64位系统下的Java环境与注册表条件(以15.7版本为例)

本文详细解析了使用Advanced Installer 15.7版本在64位系统下打包Java应用时的常见问题与解决方案。重点介绍了注册表重定向机制、Java环境检测的双保险策略、环境变量设置的隐藏坑以及权限管理的进阶技巧,帮助开发者避免安装包在用户机器上无法运行的幽灵问题。

weixin_28676289的博客 324

几个未公开的 DBCC 命令

<!-- /* Style Definitions */ table.MsoNormalTable {mso-style-name:普通表格; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-a

CathySun118的专栏 1623

Python爬虫实战:逆向解析央视频加密参数(附完整代码)

本文详细解析了央视频加密体系的技术实现,通过Python逆向工程实战演示如何解密动态密钥、AES加密和自定义哈希算法等核心组件。文章提供完整代码示例,涵盖GUID生成、参数构造和异步请求处理,帮助开发者掌握现代视频平台的反爬机制破解方法。

weixin_42532473的博客 1131

Unity中实现FairyGUI弹窗背景模糊的3种方法对比(附完整代码)

本文详细对比了Unity中实现FairyGUI弹窗背景模糊的3种方法,包括FairyGUI原生滤镜方案、多摄像机混合渲染方案和渲染纹理动态混合方案。每种方法均附有完整代码示例,帮助开发者根据项目需求选择最佳方案,实现镜头虚化模糊效果,提升游戏UI的视觉沉浸感。

ff678的博客 232

DBCC命令详细介绍

 一:DBCC 1:什么是DBCC   我不是教学老师,我也说不到没有任何无懈可击的定义,全名:Database Console Commands。顾名思义“数据库控制台命令”,说到“控制台“,我第一反应就是chrome的开发者工具,不知道你的第一反应会是怎样?开发者工具中,只要javascript能认的语法,你都可以在控制台键入。。。同样的道理sqlserver能认的也是一样。  ...

baobaojinjin的博客 649

安鸾渗透测试平台-CTF系列-bash

工具Xshell 公网VPS接收反弹shell Xshell新手的下载及安装教程(超详细)_新手程序员攀爬之路的博客-优快云博客_xshell使用教程 Xshell连接后 #!/bin/bash cat ${0} while : do echo "$" read input output=`$input` 显示了一个文件,不过咋做呢?这里可能考察的是linux的语法 方法 输入bash 获得shell cat ${0} while : do .

AAAAAAAAAAAA66的博客 2689

DBCC用法

http://www.cnblogs.com/lilycnblogs/archive/2011/03/31/2001372.html DBCC是SQL Server提供的一组控制台命令,功能很强大,掌握一些必要的语句,对操作数据库有不少帮助,所以决定整理一下,发现已有不少类似的

Sky_666的专栏 776

SwinTransformer 改进:SSPCAB模块(2024最新改进方法)

SSPCAB(Spatial Pyramid Pooling with Channel Attention Block)是2024年提出的一种新型神经网络架构改进方法,专注于在保持高精度的同时显著降低计算复杂度和参数量。该方法通过创新的空间金字塔池化与通道注意力机制的结合,实现了网络结构的紧凑化和运算效率的大幅提升。核心创新点1. 混合空间金字塔池化(Hybrid Spatial Pyramid Pooling, HSPP)多尺度动态核池化:根据输入特征图尺寸动态调整池化核大小和步长交叉级联结构。

Henry的博客 1309

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

SQL Server 2000 基础(7)——DBCC命令

一、定义微软当初从SYBASE将DBCC是作为数据库一致性检查(Database Consistency Check)命令扩展过来的,但经过后来的扩展,DBCC命令的功能范围增大,现在称之为数据库控制台命令(Database Console Command)。二、公开的DBCC命令2.1验证类对数据库、文件组、表、索引、数据库页的分配、系统目录进行的验证操作。 DBCC C

张骞 2310

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

SQLSERVER DBCC命令大全

SQLSERVER DBCC命令大全 DBCC DROPCLEANBUFFERS:从缓冲池中删除所有缓存,清除缓冲区 在进行测试时,使用这个命令可以从SQLSERVER的数据缓存data cache(buffer)清除所有的测试数据,以保证测试的公正性。 需要注意的是这个命令只移走干净的缓存,不移走脏缓存。由于这个原因,在执行这个命令前,应该先执行CheckPoint,将所有脏的缓...

dingshen2767的博客 386

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

【转贴收藏】sql2000 undoocumented DBCC Commands

Some Useful Undocumented SQL Server 7.0 and 2000 DBCC Commands Alexander Chigrik chigrik@mssqlcity.comIntroduction In this article, I want to tell you about some useful undocumented DBCC commands...

aoshouduo3992的博客 970

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

想起了上篇博客有个哥们说普及普及DBCC,虽然有点迷迷糊糊的。。。看能不能写出点新 花样。。。。不管学什么语言,还是数据库,你得看的比人家深一层。。。最可悲的就是停留的在表层,这样每次版本升级后,出了些新花样,然后你 就觉得太他妈神奇了,可事实真的是这样么?有个很现实的例子就是C#各个版本中的语法糖。。。。。当你ILdasm之后,你会发现都是些基础不能再 基础的东西,C#有个好处

Golden_lion的博客 374

dbcc

dbcc help(?) 查询所有的DBCC命令dbcc help(命令) 查询指定命令的语法dbcc useroptions 返回当前user的set选项dbcc 状态验证类命令dbcc checkalloc(数据库名称) 检查指定数据的磁盘空间分配结构的一致性dbcc checkcatalog 检查指定数据库的系统表内和系统表间一致性dbcc checkconstraints 检查

jian704的专栏 809

Sql Server中的DBCC命令详细介绍

一:DBCC 1:什么是DBCC   我不是教学老师,我也说不到没有任何无懈可击的定义,全名:Database Console Commands。顾名思义“数据库控制台命令”,说到“控制台“,我第一反应就是chrome的开发者工具,不知道你的第一反应会是怎样?开发者工具中,只要javascript能认的语法,你都可以在控制台键入。。。同样的道理sqlserver能认的也是一样。

跳跳投的博客 1331
上一篇: Free SQL Server tools that might make your life a little easier
下一篇: SQLserver数据文件(MDF)的页面文件头结构剖析
DICOMV3PACS
博客等级 码龄17年 161粉丝 72原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值