Sybase Business Intelligence Solutions - Database Management, Data Warehousing Software, Mobile Enterprise Applications and Messaging
Sybase Brand Color Bar
delete

Search for    in all of Sybase.com
view all search results right arrow
  blank
 
 
 
 
 
 
 
 
 
 
Support > Technical Documents > Document Types > Technote > Useful dbcc Commands

Useful dbcc Commands

This TechNote describes key dbcc commands.
 
RSS Feed
 
 
 

This section provides an overview of a number of database consistency checker (dbcc) commands useful for diagnosing and troubleshooting Adaptive Server problems.

Note:

This information also appears in the 11.9.2 Error Messages and Troubleshooting Guide. Unless otherwise specified, all references in this TechNote are to sections of that document.

Standard dbcc Commands

The standard, supported dbcc commands used in this document are as follows:

dbcc Command

Purpose

tablealloc

checks allocation information for the specified table.

textalloc

checks allocation information in text pages for the specified table.

indexalloc

checks allocation information for the specified index.

checkalloc

runs the same checks as tablealloc, for all pages in a database.

checktable

checks the integrity of data and index pages in the specified table.

checkdb

runs the same checks as checktable, for all tables in a database.

checkstorage

combines some of the checks of the above commands, and provides additional checks.

reindex

checks the integrity of indexes on user tables. prints a message when it finds the first index error and then drops/recreates the index.

For a complete description of these commands, see the System Administration Guide.

Other dbcc Commands

This document utilizes a number of additional dbcc commands. These commands, listed below, are useful in specific troubleshooting situations to gather information and diagnose problems.

WARNING!

These are undocumented and non-standard commands. Sybase Technical Support does not support them for general use. Although the command syntax is provided here for reference, you should use these commands only to diagnose specific errors as described in this document, and with the specific syntax shown in those sections. Failure to do so could cause performance problems and/or database corruption.

Command: dbcc page

Purpose: Prints the contents of a page within a database.

Usage:

dbcc page (dbid, pageno,[printopt [,cache [,logical [,cachename]]]])

or

dbcc page (dbname, pageno,[printopt [,cache [,logical [,cachename]]]])

dbid      - database ID
dbname    - database name
pageno    - page number
printopt  - output format:
            0 - print buffer and page header only (default)
            1 - print buffer and page headers, rows and
                offset table
            2 - print buffer and page headers, hex dump
                of data and offset table
cache     - where to get the page:
            0 - read page from disk
            1 - read page from cache if present, otherwise
                read from disk (default)
logical   - the page type
            0 - pageno is a virtual page
            1 - pageno is a logical page (default)
cachename - the cache name
           -1 - all caches

Command: dbcc pglinkage

Purpose: checks the linkage of a page chain.

Usage:

dbcc pglinkage (dbid, start_pg_num, number_pages,                printopt, search_for, search_order)

dbid         - database ID
start_pg_num - page number at which 
               to start checking
number_pages - the number of pages to check:
               0 - check all pages 
printopt     - denotes which pages to display:
               0 - display only the number of 
                   pages checked
               1 - display the last 16 pages checked
               2 - display all the page numbers checked
search_for   - stop checks when this page number 
               is reached
search_order - direction of search:
               0 - follow previous page pointers
               1 - follow next page pointers

Command: dbcc log

Purpose: displays transaction log records.

Usage:

dbcc log (dbid, objid, pageno, rowno, nrecs, type, printopt)

dbid     - database ID
objid    - can be < 0, zero, or > 0. Meaning of this
           option depends on the values of 'pageno'
           and/or 'rowno'. For example, if objid >0 and
           'pageno' and 'rowno' = 0, all records for
           that object are displayed.
pageno   - page number (or 0)
rowno    - row number (or 0)
nrecs    - number of records and log scan direction
type     - the type of log record to display
printopt - denotes display options
           0 - display header and data
           1 - display header only.
 

Command: dbcc traceflags

(available with 11.0.3 and later)

Purpose: Shows what traceflags, if any, are currently active in the server.

Usage:

dbcc traceflags

Command: dbcc traceon

Purpose: activates the specified trace flag.

Usage:

dbcc traceon (trace_flag)

Command: dbcc traceoff

Purpose: de-activates the specified trace flag.

Usage:

dbcc traceoff (trace_flag)

Command: dbcc memusage

Purpose: Shows memory allocation for server structures and objects, for example the size and number of stored procedures.

Usage:

dbcc memusage

WARNING!

Running dbcc memusage on a multi-engine server can cause the other running processes to timeslice.



 

DOCUMENT ATTRIBUTES
Last Revised: Mar 23, 1999
Product: Adaptive Server Enterprise
Technical Topics: Database Admin
  
Business or Technical: Technical
Content Id: 20405
Infotype: Technote
 
 
 

© Copyright 2014, Sybase Inc. - v 7.6 Home / Contact Us / Help / Jobs / Legal / Privacy / Code of Ethics