Switch to standard view 
  Sybase logo

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


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



checks allocation information for the specified table.


checks allocation information in text pages for the specified table.


checks allocation information for the specified index.


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


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


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


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


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.


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.


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


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.


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.


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.


dbcc traceflags

Command: dbcc traceon

Purpose: activates the specified trace flag.


dbcc traceon (trace_flag)

Command: dbcc traceoff

Purpose: de-activates the specified trace flag.


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.


dbcc memusage


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

Back to Top
© Copyright 2010, Sybase Inc.