Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««123»»

CheckDB Expand / Collapse
Author
Message
Posted Monday, August 17, 2009 9:57 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, April 15, 2014 12:24 PM
Points: 2,835, Visits: 1,124
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.



Post #772042
Posted Monday, August 17, 2009 10:00 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 12:10 PM
Points: 3,766, Visits: 3,584
Five people got the question correct so far, I am not sure how that happened.
Post #772044
Posted Monday, August 17, 2009 11:13 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, March 24, 2014 5:16 PM
Points: 382, Visits: 1,136
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/
Post #772116
Posted Monday, August 17, 2009 11:27 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 12:10 PM
Points: 3,766, Visits: 3,584
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.
Post #772123
Posted Monday, August 17, 2009 11:45 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 9:36 AM
Points: 5,471, Visits: 23,502
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
Post #772132
Posted Monday, August 17, 2009 11:57 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, March 24, 2014 5:16 PM
Points: 382, Visits: 1,136
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/
Post #772142
Posted Monday, August 17, 2009 1:03 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, April 15, 2014 12:24 PM
Points: 2,835, Visits: 1,124
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.



Post #772189
Posted Monday, August 17, 2009 1:09 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, March 24, 2014 5:16 PM
Points: 382, Visits: 1,136
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/
Post #772197
Posted Monday, August 17, 2009 1:46 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 9:36 AM
Points: 5,471, Visits: 23,502
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
Post #772215
Posted Monday, August 17, 2009 2:57 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, March 24, 2014 5:16 PM
Points: 382, Visits: 1,136
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/
Post #772290
« Prev Topic | Next Topic »

Add to briefcase ««123»»

Permissions Expand / Collapse