Explain some DBCC commands?

Answer Posted / samar

DBCC commands

1. DBCC CHECKCONSTRAINTS <db_name>|<indexname> WITH
ALL_CONSTRAINTS
Here with all coinstraints include disable coinstraints also

DBCC CHECKCONSTRAINTS checks the integrity of foreign key
and checked constraints, but does not check the integrity
of a table's on-disk data structures. These data structure
checks can be performed with DBCC CHECKDB and DBCC
CHECKTABLE

2. DBCC CHECKTABLE performs a physical consistency check on
tables and indexed views. The NOINDEX option, used only for
backward compatibility, also applies to indexed views.
For the specified table, DBCC CHECKTABLE checks that:
· Index and data pages are correctly linked.
· Indexes are in their proper sort order.
· Pointers are consistent.
· The data on each page is reasonable.
· Page offsets are reasonable.

DBCC CHECKTABLE does not acquire a table lock by default.
Instead, it acquires a schema lock that prevents meta data
changes but allows changes to the data.
To perform DBCC CHECKTABLE on every table in the database,
use DBCC CHECKDB.

3. DBCC DBREINDEX can rebuild all of the indexes for a
table in one statement, which is easier than coding
multiple DROP INDEX and CREATE INDEX statements. Because
the work is done by one statement, DBCC DBREINDEX is
automatically atomic

4. DBCC HELP returns a result set displaying the syntax for
the specified DBCC statement


5. DBCC INDEXDEFRAG can defragment clustered and
nonclustered indexes on tables and views. DBCC INDEXDEFRAG
defragments the leaf level of an index so that the physical
order of the pages matches the left-to-right logical order
of the leaf nodes, thus improving index-scanning
performance.
DBCC INDEXDEFRAG also compacts the pages of an index,
taking into account the FILLFACTOR specified when the index
was created. Any empty pages created as a result of this
compaction will be removed

Is This Answer Correct ?    8 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the advantages of passing name-value pairs as parameters?

665


Mention the different authentication modes in sql server.

539


Do you know how to store and query spatial data?

609


How to get a list of columns using the "sp_help" stored procedure in ms sql server?

584


How will you make an attribute not process? : sql server analysis services, ssas

588






Can we write a distributed query and get some data which is located on other server and oracle database?

769


What is compression - row-level and page-level compression?

535


What is a partition key?

523


what is difference between NULL and ISNULL in SQL Server 2008?

584


Which sql server table is used to hold the stored procedure script?

481


difference between Clustered index and non clustered index ?

583


What is inner join in sql server joins?

549


What do you mean by sql server agent?

549


How to create a simple user defined function in ms sql server?

547


What is use of attributehierarchyenabled? : sql server analysis services, ssas

615