Some Useful Undocumented SQL Server 6.5 DBCC Commands

DBCC REBUILDEXTENTS

DBCC rebuildextents rebuilds an object’s extent chain. You should set the READ ONLY option for your database, before you run this command.

Syntax:

DBCC rebuildextents(dbid, objid, indexid)

where:

dbid – database ID

objid – object ID

indexid – index ID

Example:

DBCC TRACEON (3604)
DECLARE @dbid int, @objectid intSELECT @dbid = DB_ID(‘pubs’)
SELECT @objectid = object_id(‘authors’)
DBCC rebuildextents(@dbid,@objectid,1)

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 an example:

DBCC TRACEON (3604)
DBCC resource

DBCC SHOW_BUCKET

This command shows hash bucket information for the specified pageid.

Syntax:

DBCC show_bucket(dbid|dbname, pageid, lookup_type)

where:

dbid|dbname – database ID or database name

page – logical page number of page being looked for

lookup_type – how to conduct search

1 – use hash algorithm to look in the bucket the page should be in

2 – scan the entire buffer cache

Example:

DBCC TRACEON (3604)DBCC show_bucket (pubs, 1, 1)

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 (dbname, objname, printopt={ 0 | 1 | 2 })

where:

dbname – is the database name

objname – is the table name

printopt – is the type of the output

0 – minimum information (only the pages headers, the total
number of data pages in this table and the total number
of data rows in this table)

1 – more information (plus full rows structure)

2 – as printopt = 1, but without rows separation (full dump)

by default printopt = 0

Example:

DBCC TRACEON (3604)DBCC tab (pubs, ‘authors’)

Published with the explicit written permission of the author. Copyright 2001.

]]>

Leave a comment

Your email address will not be published.