SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Benefits of DBCC Check DB and performance


Benefits of DBCC Check DB and performance

Author
Message
Grant Fritchey
Grant Fritchey
SSC Guru
SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)

Group: General Forum Members
Points: 223635 Visits: 33564
GilaMonster (8/20/2013)
Grant Fritchey (8/20/2013)
I thought the internal/hidden snapshot was a different critter than the snapshots we create. But, hey, happy to be wrong.


No, the same thing, same behaviour, same mechanics.

The only difference with the CheckDB snapshot is that it's created on all editions (only on Enterprise can you create an explicit snapshot) and it puts the snapshot files into NTFS alternate streams.


But if you run DBCC against a snapshot, do you get another snapshot? And since it's going back to the original pages anyway for all the reads, what's the point of separating it out?

----------------------------------------------------
The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood...
Theodore Roosevelt

The Scary DBA
Author of: SQL Server Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
GilaMonster
GilaMonster
SSC Guru
SSC Guru (554K reputation)SSC Guru (554K reputation)SSC Guru (554K reputation)SSC Guru (554K reputation)SSC Guru (554K reputation)SSC Guru (554K reputation)SSC Guru (554K reputation)SSC Guru (554K reputation)

Group: General Forum Members
Points: 554090 Visits: 47746
Grant Fritchey (8/20/2013)
GilaMonster (8/20/2013)
Grant Fritchey (8/20/2013)
I thought the internal/hidden snapshot was a different critter than the snapshots we create. But, hey, happy to be wrong.


No, the same thing, same behaviour, same mechanics.

The only difference with the CheckDB snapshot is that it's created on all editions (only on Enterprise can you create an explicit snapshot) and it puts the snapshot files into NTFS alternate streams.


But if you run DBCC against a snapshot, do you get another snapshot?


No.

And since it's going back to the original pages anyway for all the reads, what's the point of separating it out?


Transactional consistency for logical checks. Otherwise you'd have to do it the SQL 2000 way, of running crash recovery in-memory to get a stable view of the tables. Massively complex. Snapshots ensure transactional consistency and a stable view of the tables which means that the CheckDB process doesn't have to worry about concurrent changes while working through the database.

That's why the alternative to using a snapshot is WITH TABLOCK - take table level locks to ensure the table can't change while being checked.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Grant Fritchey
Grant Fritchey
SSC Guru
SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)

Group: General Forum Members
Points: 223635 Visits: 33564
GilaMonster (8/20/2013)
Grant Fritchey (8/20/2013)
GilaMonster (8/20/2013)
Grant Fritchey (8/20/2013)
I thought the internal/hidden snapshot was a different critter than the snapshots we create. But, hey, happy to be wrong.


No, the same thing, same behaviour, same mechanics.

The only difference with the CheckDB snapshot is that it's created on all editions (only on Enterprise can you create an explicit snapshot) and it puts the snapshot files into NTFS alternate streams.


But if you run DBCC against a snapshot, do you get another snapshot?


No.

And since it's going back to the original pages anyway for all the reads, what's the point of separating it out?


Transactional consistency for logical checks. Otherwise you'd have to do it the SQL 2000 way, of running crash recovery in-memory to get a stable view of the tables. Massively complex. Snapshots ensure transactional consistency and a stable view of the tables which means that the CheckDB process doesn't have to worry about concurrent changes while working through the database.

That's why the alternative to using a snapshot is WITH TABLOCK - take table level locks to ensure the table can't change while being checked.


Sorry, you misunderstood the second part of that question. Not why does Microsoft create a snapshot when doing DBCC. I've read Paul's explanation there. I meant, why would you create your own snapshot first?

----------------------------------------------------
The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood...
Theodore Roosevelt

The Scary DBA
Author of: SQL Server Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
GilaMonster
GilaMonster
SSC Guru
SSC Guru (554K reputation)SSC Guru (554K reputation)SSC Guru (554K reputation)SSC Guru (554K reputation)SSC Guru (554K reputation)SSC Guru (554K reputation)SSC Guru (554K reputation)SSC Guru (554K reputation)

Group: General Forum Members
Points: 554090 Visits: 47746
Grant Fritchey (8/20/2013)
I meant, why would you create your own snapshot first?


I wouldn't.
Only reason maybe is if the drive with the data files on is nearly full and there's enough concurrent activity that the snapshot runs the drive out of space. But in that case there are other problems that need to be fixed.

Other case, when there's some filter driver or other installed software that breaks NTFS alternate streams. In that case CheckDB will fail, so you can try and run CheckDB on an explicitly created snapshot to see if the problem is just the alternate streams and as a way to run until the offending software gets fixed or removed.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


mohan.bndr
mohan.bndr
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1226 Visits: 481
Thanks for understanding to get the Checkdb implementations with the snapshots.
mohan.bndr
mohan.bndr
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1226 Visits: 481
GilaMonster (8/20/2013)
Grant Fritchey (8/20/2013)
I thought the internal/hidden snapshot was a different critter than the snapshots we create. But, hey, happy to be wrong.


No, the same thing, same behaviour, same mechanics.

The only difference with the CheckDB snapshot is that it's created on all editions (only on Enterprise can you create an explicit snapshot) and it puts the snapshot files into NTFS alternate streams.


Thanks for understanding to get the Checkdb implementations with the snapshots. But here one more thing , will it DBCC Checkdb work on standard edition as i am not able to run DBCC Checkdb against database and the drive also having sufficient free space for datafile. Will it DBCC Checkdb creates snapshot in standard edition ? and Will it be possible to create snapshot by manually in standard edition?.... Please advise !
GilaMonster
GilaMonster
SSC Guru
SSC Guru (554K reputation)SSC Guru (554K reputation)SSC Guru (554K reputation)SSC Guru (554K reputation)SSC Guru (554K reputation)SSC Guru (554K reputation)SSC Guru (554K reputation)SSC Guru (554K reputation)

Group: General Forum Members
Points: 554090 Visits: 47746
Yes, checkDB works fine on Standard Edition, and all other editions. It does create the hidden snapshot on all editions.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


HanShi
HanShi
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: General Forum Members
Points: 18680 Visits: 3790
mohan.bndr (8/29/2013)
... as i am not able to run DBCC Checkdb against database and the drive also having sufficient free space for datafile....

What is the error message you get when you execute the CHECKDB command?

** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
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