Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


CheckDB


CheckDB

Author
Message
Scott Coleman
Scott Coleman
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2942 Visits: 1417
I hesitated to answer because I was positive at least one of the answers was going to have some wacky interpretation.

DBCC CHECKDB does not fail when run against either master or tempdb, unless some other conditions are met. It MIGHT fail against any database, given a sufficient level of data corruption or hardware failure, but it is not true that it WILL fail against tempdb or master.

From BOL under "DBCC CHECKDB":
Checks the logical and physical integrity of all the objects in the specified database

I don't see any quibbles there about statistics. It may not refresh statistics, but it does check that they are correctly allocated.



Cliff Jones
Cliff Jones
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4069 Visits: 3648
Five people got the question correct so far, I am not sure how that happened.
Sankar Reddy
Sankar Reddy
Old Hand
Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)

Group: General Forum Members
Points: 382 Visits: 1250
First, I take the criticism that this could have been worded better. I wrote this probably 6-8 months ago but got published now so the context is NOT fresh off my mind.

Check all that apply that are true about DBCC CHECKDB.

1) It will fail when trying to run against tempdb database.

FROM BOL: http://msdn.microsoft.com/en-us/library/ms176064.aspx

Running DBCC CHECKDB against tempdb does not perform any allocation or catalog checks and must acquire shared table locks to perform table checks. This is because, for performance reasons, database snapshots are not available on tempdb. This means that the required transactional consistency cannot be obtained.

DBCC CHECKDB will run successfully against tempdb but may NOT perform all the checks as it does for other user databases. Note that it will NOT fail either. So, it is NOT true.

2) It will fail when trying to run against the master database.

FROM BOL: http://msdn.microsoft.com/en-us/library/ms176064.aspx

when DBCC CHECKDB is executed against the master database, a second CHECKDB is also run internally on the Resource database.

DBCC CHECKDB will run successfully against master. So, it is NOT true.

3) It uses tempdb space.

This is obvious and is true.

4) It examines all indexes in the database including the disabled indexes.

FROM BOL: http://msdn.microsoft.com/en-us/library/ms176064.aspx

DBCC CHECKDB does not examine disabled indexes. For more information about disabled indexes, see Disabling Indexes.

DBCC CHECKDB is re-written in SQL Server 2005 and will NOT check the disabled indexes. So, it is NOT true.

5) It has a flag not to run against nonclustered indexes.

FROM BOL: http://msdn.microsoft.com/en-us/library/ms176064.aspx

-- Check the AdventureWorks database without nonclustered indexes.
DBCC CHECKDB (AdventureWorks, NOINDEX);
GO

So, it is true.

6) It is comprehensive and validates the logical and physical integrity of all the objects in the specified database including tables, indexes, indexed views & statistics.

I deliberately wanted people to get this incorrectly and thats why I added STATISTICS at the end of the end sentence. I saw only one reference on this on the CONNECT item and wanted to share this with every one. Before I knew about the connect item, I didn't know that CHECKDB will NOT check the STATISTICS.

Sankar Reddy | http://SankarReddy.com/
Cliff Jones
Cliff Jones
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4069 Visits: 3648
Thanks for the explanation. I missed that 'Statistics' was in the last answer. When I first read the answers I thought you were saying that is would fail against Tempdb. I mis-read that also. Not enough coffee I guess.
bitbucket-25253
bitbucket-25253
SSCertifiable
SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)

Group: General Forum Members
Points: 5689 Visits: 25280
Sankar Reddy
5) It has a flag not to run against nonclustered indexes.

FROM BOL: http://msdn.microsoft.com/en-us/library/ms176064.aspx

-- Check the AdventureWorks database without nonclustered indexes.
DBCC CHECKDB (AdventureWorks, NOINDEX);
GO
So, it is true.


Repeating myself:
From Books On Line
DBCC CHECKDB

Runs DBCC CHECKALLOC on the database.
Runs DBCC CHECKTABLE on every table and view in the database.
Runs DBCC CHECKCATALOG on the database

From DBCC CHECKALLOC.
http://technet.microsoft.com/en-us/library/aa258809(SQL.80).aspx

[quote]Note NOINDEX is maintained for backward compatibility only. All indexes are checked when executing DBCC CHECKALLOC.

From Merriam-Webster Dictionary for ALL
every member or individual component of

So then Sankar Reddy what you are saying is that DBCC CHECKDB when invoking DBCC CHECKALLOC passes to it a an undocumented parameter so that DBCC CHECKALLOC does NOT perform as it states in BOL

If everything seems to be going well, you have obviously overlooked something.

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Sankar Reddy
Sankar Reddy
Old Hand
Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)

Group: General Forum Members
Points: 382 Visits: 1250
bitbucket,

Not sure I am grasping your last post. Is it a question or statement?

Note that DBCC CHECKDB is re-written by Paul Randal in SQL Server 2005 but you are referring to a BOL link for SQL Server 2000.

This is where I take the criticism that the question could have been worded better.

Sankar Reddy | http://SankarReddy.com/
Scott Coleman
Scott Coleman
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2942 Visits: 1417
From Nov 2008 Books Online:
DBCC CHECKALLOC checks the allocation of all pages in the database, regardless of the type of page or type of object to which they belong. It also validates the various internal structures that are used to keep track of these pages and the relationships between them.

When you say this does not check statistics, what exactly isn't being checked? It doesn't resample the data and update statistics, but it does check the their logical and physical integrity.



Sankar Reddy
Sankar Reddy
Old Hand
Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)

Group: General Forum Members
Points: 382 Visits: 1250
Scott Coleman (8/17/2009)
From Nov 2008 Books Online:
DBCC CHECKALLOC checks the allocation of all pages in the database, regardless of the type of page or type of object to which they belong. It also validates the various internal structures that are used to keep track of these pages and the relationships between them.

When you say this does not check statistics, what exactly isn't being checked? It doesn't resample the data and update statistics, but it does check the their logical and physical integrity.


Scott,

It doesn't check the their logical and physical integrity of STATISTICS based on the connect item (https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=158623&wa=wsignin1.0)

There are no references to this fact anywhere else except the connect item and that's what I tried to share with everyone with this quiz.

I have asked Paul Randal to shed some light on this one and hopefully if time permits and if he is interested will share some details.

Sankar Reddy | http://SankarReddy.com/
bitbucket-25253
bitbucket-25253
SSCertifiable
SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)

Group: General Forum Members
Points: 5689 Visits: 25280
Sankar Reddy
Note that DBCC CHECKDB is re-written by Paul Randal in SQL Server 2005 but you are referring to a BOL link for SQL Server 2000.


Sankar - take my rants and raves as just that ... Now for the irony of it all .. I attended a user group meeting which featured Paul Randal of SQLSkills.com and his wife Kimberly Tripp as speakers last thursday evening. They put on an excellent 2 hour training session. Wish your question has been posted on Thursday or a day or a few before, and I could have discussed with him ... oh well. If you get a chance to talk with him, may I ask you to post what he concluded (If Paul agrees to the posting).

For all that has been posted in this forum, let me say your question made me think, and in particular that addition of statistics to the last selection was excellent. After all the question of the day is to make people think and learn and in that your question did a excellent job.

Further I hope that you will NOT stop submitting QODs, but bear with the comments from us nitpickers (those who find insignificant details of something unsatisfactory, often unjustifiably).

Again thanks for a good question.

If everything seems to be going well, you have obviously overlooked something.

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Sankar Reddy
Sankar Reddy
Old Hand
Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)Old Hand (382 reputation)

Group: General Forum Members
Points: 382 Visits: 1250
bitbucket,

Most of the comments on this post were constructive criticism, which I took nicely and Thanks for the kind words. I wish I could have wrote more questions on SSC but the publishing time is becoming too long. It almost took 6 months to publish this and that somehow dampens the spirit of writing more. I guess Steve Jones is getting lot of contributions for quiz questions and he must be doing the best to publish them in a timely fashion.

Sankar Reddy | http://SankarReddy.com/
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search