Monitoring Databases  «Prev  Next»

Dbcc commands in SQL-Server

Microsoft SQL Server Database Console Commands (DBCC) are used for checking database integrity, performing maintenance operations on databases, tables, indexes, and filegroups, and collecting and displaying information during troubleshooting issues.
The first DBCC command to become familiar with is the DBCC HELP command, which returns the syntax and all the options for any DBCC command. The following command returns the syntax for DBCC CHECKDB:
DBCC CHECKDB:
DBCC HELP (’CHECKDB’);

dbcc CHECKDB
(
{ ‘database_name’ | database_id | 0 }
[ , NOINDEX
| { REPAIR_ALLOW_DATA_LOSS
| REPAIR_FAST
| REPAIR_REBUILD
} ]
)

dbcc dbreindex Rebuilds the indexes for a table
dbcc checkalloc Checks the data pages allocated to tables and indexes
dbcc checkdb Checks the data pages allocated to all tables and indexes and checks structural integrity of the database
dbcc checkcatalog Verifies SQL Server system tables are correct
dbcc checkfilegroup Validates the data in a file group
dbcc checkident Validates a tables identity column
dbcc checktable Checks the data pages allocated to a tables and indexes
dbcc show_contig Displays fragmentation information about a table
dbcc sqlperf Monitors the transaction log