Wednesday, 11 March 2015

DBCC Commands in SQL SERVER 2008

DBCC acronym of Database Console Commands

DBCC Commands are used to check the consistency of the Databases or Database Objects. While executing DBCC commands the DB engine creates a database snapshot and then runs the checks against this snapshot. After the DBCC command is completed, this snapshot is dropped.

             There are four types of DBCC Commands:

     1.    Maintenance:

      DBCC INPUTBUFFER
      DBCC SHOWCONTIG

    2.    Miscellaneous:

      DBCC CHECKCATALOG
      DBCC CHECKINDENT

    3.    Informational:

      DBCC DROPCLEANBUFFERS
      DBCC SHRINKFILE

    4.    Validation:

      DBCC DLLNAME (FREE)
      DBCC TRACEOFF

      Few DBCC Commands:
    DBCC CHECKALLOC [(database_name [, NOINDEX])]
    DBCC CHECKCATALOG
    DBCC CHECKTABLE(table_name [, NOINDEX | index_id]
    DBCC CHECKDB[(database_name [, NOINDEX])]
    DBCC CHECKIDENT[(table_name)]
    DBCC DBREINDEX ([[`db_name.username.table_name'[, ind_name[, fillfactor [,      SORTED_DATA | SORTED_DATA_REORG])
    DBCC DBREPAIR (database_name, DROPDB [, NOINIT])
    DBCC INPUTBUFFER (spid)
    DBCC MEMUSAGE
    DBCC NEWALLOC[(database_name [, NOINDEX])]
    DBCC OPENTRAN({database_name} | {database_id})[WITH TABLERESULTS]
    DBCC OUTPUTBUFFER (spid)
    DBCC PERFMON
    DBCC ROWLOCK (dbid, tableid, set)
    DBCC SHOW_STATISTICS(table_name, index_name)
    DBCC SHOWCONTIG(table_id, [index_id])
    DBCC SHRINKDB (database_name [, new_size[, `MASTEROVERRIDE']])
    DBCC SQLPERF ({IOSTATS | LRUSTATS | NETSTATS| RASTATS [, CLEAR]} {THREADS} | {LOGSPACE})
    DBCC TEXTALL [({database_name | database_id}[, FULL | FAST])]
    DBCC TEXTALLOC [({table_name | table_id}[, FULL | FAST])]
    DBCC TRACEOFF (trace#)
    DBCC TRACEON (trace#)
    DBCC TRACESTATUS (trace# [, trace#...])
    DBCC UPDATEUSAGE ({0 | database_name}[, table_name [, index_id]]) | USEROPTIONS}[WITH COUNT_ROWS]

No comments:

Post a Comment