Microsoft KB Archive/83065

= INFO: Description of DBCC PAGE Command =

Article ID: 83065

Article Last Modified on 2/14/2005

-

APPLIES TO


 * Microsoft SQL Server 4.21a Standard Edition
 * Microsoft SQL Server 6.0 Standard Edition
 * Microsoft SQL Server 6.5 Standard Edition

-



This article was previously published under Q83065



SUMMARY
The information below is an elaboration on Sybase's description of the database consistency checker (DBCC) commands (taken from the Sybase internals course &quot;SQL Server Diagnostic Manual&quot;).

This article discusses reasons for the use of DBCC PAGE and a description of how to use it.



MORE INFORMATION
NAME: DBCC PAGE

FUNCTION: Prints out the contents of a SQL Server page.

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.

Version 4.2
DBCC PAGE is used to obtain the data that is contained in a SQL Server page structure. If you are using DBCC PAGE and want the information returned to the front-end you are using, remember that a trace flag must be set. The command DBCC TRACEON(3604) must be executed. If the information is to be sent to the errorlog instead, then use the DBCC TRACEON flag 3605 rather then 3604. Usually the most useful information can be obtained in the page header, which contains, among other things, the object that the page belongs to, the previous page pointer, and the next page pointer.

The rows and offset table can also be displayed by changing the print option parameter. Rows are displayed in reverse binary from how they are stored on the actual page. Possible row length errors can be discovered using this method, as well as offset table problems. Displaying all of the rows could also be used to manually extract data from the database if the particular page could not be retrieved by SQL server and the data was extremely critical.

Example
Below is an example of the use of DBCC PAGE. The page that is returned has the page header, rows, and offset table. This page comes from the master database and is page number one, which belongs to object number 1, which is sysobjects. This is the page as it appears on disk.

dbcc page(1,1,1)

PAGE:

Page read from disk.

BUFFER: Buffer header for buffer 0x16674c16 page=0x28e77780 bdnew=0x0 bdold=0x0 bhash=0x0 bnew=0x0 bold=0x0 bvirtpg=0x5 bdbid=1 bpinproc=0 bkeep=0 bspid=0 bstat=0x0000 bstat2=0x0000  bpageno=0

PAGE HEADER:

Page header for page 0x28e77780

pageno=1 nextpg=6 prevpg=0 objid=1 timestamp=0001 08ae93d2

nextrno=13 level=0 indid=0 freeoff=1058 minlen=64

page status bits: 0x100,0x1,

DATA: Offset 32 - 28e777a0: 01000100 01000000 00007100 00000000 00000000 ..........q......... 28e777b4: 00000000 00000000 00000000 00000000 00000000 .................... 28e777c8: 00000000 00000000 00000000 00000000 00000000 .................... 28e777dc: 53200000 4f007379 736f626a 65637473 024c42    S ..O.sysobjects.LB.

Offset 111 - 28e777ef: 01010100 02000000 00005100 00000000 00000000 ..........Q......... 28e77803: 00000000 00000000 00000000 00000000 00000000 .................... 28e77817: 00000000 00000000 00000000 00000000 00000000 .................... 28e7782b: 53200000 4f007379 73696e64 65786573 024c42    S ..O.sysindexes.LB.

Offset 190 - 28e7783e: 01020100 03000000 00005100 00000000 00000000 ..........Q......... 28e77852: 00000000 00000000 00000000 00000000 00000000 .................... 28e77866: 00000000 00000000 00000000 00000000 00000000 .................... 28e7787a: 53200000 4f007379 73636f6c 756d6e73 024c42    S ..O.syscolumns.LB.

Offset 269 - 28e7788d: 01030100 04000000 00007100 00000000 00000000 ..........q......... 28e778a1: 00000000 00000000 00000000 00000000 00000000 .................... 28e778b5: 00000000 00000000 00000000 00000000 00000000 .................... 28e778c9: 53200000 4d007379 73747970 6573024a 42        S ..M.systypes.JB.

Offset 346 - 28e778da: 01040100 05000000 00005100 00000000 00000000 ..........Q......... 28e778ee: 00000000 00000000 00000000 00000000 00000000 .................... 28e77902: 00000000 00000000 00000000 00000000 00000000 .................... 28e77916: 53200000 52007379 7370726f 63656475 72657302  S ..R.sysprocedures. 28e7792a: 4f42                                          OB.

Offset 428 - 28e7792c: 01050100 06000000 00005100 00000000 00000000 ..........Q......... 28e77940: 00000000 00000000 00000000 00000000 00000000 .................... 28e77954: 00000000 00000000 00000000 00000000 00000000 .................... 28e77968: 53200000 50007379 73636f6d 6d656e74 73024d42  S ..P.syscomments.MB 28e7797c:.

Offset 508 - 28e7797c: 01060100 07000000 00000100 00000000 00000000 .................... 28e77990: 00000000 00000000 00000000 00000000 00000000 .................... 28e779a4: 00000000 00000000 00000000 00000000 00000000 .................... 28e779b8: 53200000 50007379 73736567 6d656e74 73024d42  S ..P.syssegments.MB 28e779cc:.

Offset 588 - 28e779cc: 01070100 08000000 00000100 00000000 00000000 .................... 28e779e0: 00000000 00000000 00000000 00000000 00000000 .................... 28e779f4: 00000000 00000000 00000000 00000000 00000000 .................... 28e77a08: 53200000 4c007379 736c6f67 73024942           S ..L.syslogs.IB.

Offset 664 - 28e77a18: 01080100 09000000 00005100 00000000 00000000 ..........Q......... 28e77a2c: 00000000 00000000 00000000 00000000 00000000 .................... 28e77a40: 00000000 00000000 00000000 00000000 00000000 .................... 28e77a54: 53200000 50007379 7370726f 74656374 73024d42  S ..P.sysprotects.MB 28e77a68:.

Offset 744 - 28e77a68: 01090100 0a000000 00007100 00000000 00000000 ..........q......... 28e77a7c: 00000000 00000000 00000000 00000000 00000000 .................... 28e77a90: 00000000 00000000 00000000 00000000 00000000 .................... 28e77aa4: 53200000 4d007379 73757365 7273024a 42        S ..M.sysusers.JB.

Offset 821 - 28e77ab5: 010a0100 0b000000 00005100 00000000 00000000 ..........Q......... 28e77ac9: 00000000 00000000 00000000 00000000 00000000 .................... 28e77add: 00000000 00000000 00000000 00000000 00000000 .................... 28e77af1: 53200000 52007379 73616c74 65726e61 74657302  S ..R.sysalternates. 28e77b05: 4f42                                          OB.

Offset 903 - 28e77b07: 010b0100 0c000000 00005100 00000000 00000000 ..........Q......... 28e77b1b: 00000000 00000000 00000000 00000000 00000000 .................... 28e77b2f: 00000000 00000000 00000000 00000000 00000000 .................... 28e77b43: 53200000 4f007379 73646570 656e6473 024c42    S ..O.sysdepends.LB.

Offset 982 - 28e77b56: 010c0100 0d000000 00005100 00000000 00000000 ..........Q......... 28e77b6a: 00000000 00000000 00000000 00000000 00000000 .................... 28e77b7e: 00000000 00000000 00000000 00000000 00000000 .................... 28e77b92: 53200000 4c007379 736b6579 73024942           S ..L.syskeys.IB.

OFFSET TABLE: Row - Offset 12 (0xc) - 982 (0x3d6),  11 (0xb) - 903 (0x387),   10 (0xa) - 821 (0x335), 9 (0x9) - 744 (0x2e8),  8 (0x8) - 664 (0x298),   7 (0x7) - 588 (0x24c), 6 (0x6) - 508 (0x1fc),  5 (0x5) - 428 (0x1ac),   4 (0x4) - 346 (0x15a), 3 (0x3) - 269 (0x10d),  2 (0x2) - 190 (0xbe),   1 (0x1) - 111 (0x6f), 0 (0x0) - 32 (0x20),

Additional query words: Windows NT

Keywords: kbinfo kbusage KB83065

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.