Announcing the Database Corruption Challenge Winners

Download PDF

Today I am proud to announce that the Database Corruption Challenge has come to an end. I would like to say that I have met some really great people during this contest and I look forward to seeing you at PASS Summit in October, or other conference someday.

The Corruption Challenge Winners

Grand Champion - Rob FarleyAfter 10 competitions Rob Farley is the overall Champion of the Challenge with 25 points. Rob won week 2, Week 8 and Week 10. I will get the winning solution posted to my blog in the next day or two for those who are wondering how this weeks challenge was won.

 

 

 

 

Here is the list of the top scoring participants, the top 10 will receive a limited edition prize t-shirt as their badge of honor for being the top scoring participants:

 

Read more ›

Posted in Corruption Tagged with:

SQL Server Tables – BTree or Linked List?

Download PDF

Is a clustered table in SQL Server a BTree or Linked List?

When you first learn about the structure behind clustered indexes in SQL Server, you find out that the clustered index is structured as a type of B+Tree where queries that make use of the tree structure to find the rows that you are looking for. However it is not the common belief that that table with the clustered index also happens to be a doubly linked list, and that the B+Tree can be completely skipped when running a query that uses the clustered index via a clustered index scan.

Take the following table and query as an example:

CREATE TABLE [dbo].[Orders](
	[id] [int] IDENTITY(-2147483647,1) NOT NULL,
	[orderDate] [DATETIME] NOT NULL,
	[customerId] [int] NULL,
	[shippingType] varchar(100),
	[orderDetails] varchar(max),
	[totalPrice] DECIMAL(12, 2)
	CONSTRAINT [PK_Revenue] PRIMARY KEY CLUSTERED ([id] ASC, [orderDate])
);

Then insert a bunch of rows, and run a query.

Read more ›

Posted in Corruption, TSQL Tagged with: , ,

Database Corruption Challenge #10

Download PDF

Welcome to Week 10 of the Database Corruption Challenge. I have created a more corrupt, and perhaps more diabolical corruption scenario than previous weeks. This is the last week of 10 in the Database Corruption Challenge.

Here is how it works; I have created a corrupt database, then solved the corruption myself in order to prove that it is possible to fix, without data loss.

Database Corruption Challenge Details

There will be a total of 6 points available in this weeks challenge.

  • 1 point for being the first to solve the corruption challenge, and posting something about the corruption challenge on Twitter or LinkedIn. Please reference http://SteveStedman.com/Corruption in the post.
  • 1 point for having the solution right the first time you submit your solution.
  • 3 points for solving all the corruption with no data loss and providing the TSQL code (or other detailed steps) that was used to fix the corruption.
  • 1 point for completing the Blog Interview Questions. This does not have to be submitted with your solution, but it does need to be submitted by the end of the competition.

Read more ›

Posted in Corruption Tagged with:

Database Corruption Challenge #10 Grand Finale – Starts Friday

Download PDF

The Database Corruption Challenge – Grand FinaleCorruptionChallenge

The final challenge #10 in the Database Corruption Challenge starts this Friday (July 17th) at 6:00pm (Pacific Time).

After 9 other challenges we come to the final competition in this series. Many have competed, many have won, this is your chance to participate.

For those who have succeeded in all the other 9 Database Corruption Challenges you should not have a problem, however this will be the most complex corruption challenge yet.

Read more ›

Posted in Corruption Tagged with:

Database Corruption Challenge #9 – How I Corrupted the Database.

Download PDF

I was asked how I caused the corruption in Database Corruption Challenge #9. Here is how I did it.

To cause the corruption, I used the undocumented DBCC WritePage, however the same thing could have been accomplished by detaching the database, opening it with a hex editor, and then re-attaching the db.

DBCC WritePage

WARNING: DBCC WritePage is a dangerous command, that should never be used on any production database. It may invalidate your ability to get support from Microsoft on issues that arise with that database going forward. It is not my intention to encourage anyone to use DBCC WritePage ever. This is just what I used to create a corrupt database, and since creating corrupt databases is not part of the role of most DBAs, you should not use DBCC WritePage. Consider yourself warned.

Read more ›

Posted in Corruption Tagged with: , , ,

Database Corruption Challenge #9 Complete

Download PDF

Database Corruption Challenge #9 has completed with 19 winning participants, you can take a look at the scoring page for exact details. The first to solve the challenge this week was Eduardo Rezende who provided the winning solution just 58 minutes after the challenge began. The second winning solution arrived less than a minute after the first, so it was a very close win for Eduardo. If you know Eduardo (or even if you don’t), take a moment to congratulate him on his win.

Thee was no additional clue provided this time, nobody asked for one and everyone who submitted a solution had the correct answer.

The corruption consisted of several corrupt pages in a nonClustered index, and two different tables with clustered indexes that had corruption. What was interesting about the corruption was that in the two clustered indexes, even though DBCC CheckDB or CheckTable show errors, it was still possible to use SELECT * FROM tablename and get all the results back. Which meant that the corruption could be fixed by selecting everything from the table, deleting the corrupt pages, and then putting the missing data back into the table. The challenge was that one of the tables had many other tables with foreign key constraints. Some solved it by dropping the foreign keys, truncating the table, then reinserting the data and recreating the foreign keys. Others solved it by using DBCC CheckTable with the REPAIR_ALLOW_DATA_LOSS option, then they just put the rows back that were missing.

Read more ›

Posted in Corruption Tagged with: , , , , , , ,

Database Health Monitor – Historic Waits

Download PDF

With the recent release of Database Health Monitor Version 2.0 I have decided to focus on of blogging about the features and benefits of the Database Health Monitor application. There are some incredibly valuable features that are often overlooked. The purpose of this blog series is to present some of the features of the product.

If you haven’t tried Database Health Monitor, you can download it at http://DatabaseHealth.com/download. It is completely free.

Historic Waits

The Historic Waits section of Database Health monitor is in my opinion the single most valuable part of the entire product. Other vendors sell products similar the Historic Waits feature for $1500 to $2000 per SQL Server instance, making it cost prohibitive for many.

The way that Historic Waits works is that it installs a small monitoring database on a SQL Server, that can be the same SQL Server you are monitoring, or it can be a separate SQL Server just to keep track of performance.

Over time data is collected in this monitoring database that allows you to then step back in time to see what was happening with the SQL Server at a specific point in time. For instance, if you have Historic Monitoring enabled, if someone comes to you and says “The SQL Server was slow and having problems at 2:00am yesterday”, you have the ability to track down what was happening at that point in time.

The main Historic overview page shows Waits, Plan Cache Hit Ratio, Page Life Expectancy and CPU Load over time.

HistoricOverview1

Read more ›

Posted in Database Health Tagged with: , , , , , , ,

Corruption Challenge 9 Update

Download PDF

Just about 24 hours after releasing Database Corruption Challenge #9, so far there have been 15 winning solutions. The first to submit a winning solution was Eduardo Rezende.

The scores have been updated. Rob Farley is back in the lead with 18 points, second place is Raul Gonzalez with 17 points, followed closely by Neil Abrahams, André Kamman, and Patrick Flynn with 16 points each.

If you haven’t tried this weeks corruption challenge, there is still time to give it a try.  Good Luck!

Corruption Challenge #9 Details.

-Steve Stedman

Posted in Corruption Tagged with: , , , , , ,

Database Corruption Challenge #9

Download PDF

Welcome to the ninth competition of ten in the Database Corruption Challenge. This week I have created a database and then corrupted one or more parts of that database, and your goal is to fix all of the corruption without losing any data. There is a total of 4 points available this week:

  • One point for being the first person to provide a correct solution with no data loss. Won by Eduardo Rezende.
  • One point to all who get a correct solution with no data loss.
  • One point extra if you get the correct answer before any hints are given.
  • One point extra if your solution is correct the first time you submit it to me. (check your work)

For information on scores take a look at the current scores page.

Challenge9

Corruption Challenge General Info

The challenge will be to download the corrupt or somehow damaged database and attempt to recover it. If you can recover it, please send me the steps you used to recover the database, along with some proof that the database has been recovered. The goal each week will be the following:

Read more ›

Posted in Corruption Tagged with: , , , , , , ,

Database Health Monitor Version 2 Released

Download PDF

After 4 years of beta and 5500 installs of Database Health Monitor beta releases in the last 2 years, Database Health Monitor version 2 is finally complete. It is no longer in beta. If you are curious about the history of Database Health Monitor, take a look at my post from earlier in the week.

Here is a preview of one of the latest reports added in the Version 2.0 release of Database Health Monitor.

Database Health Monitor Version 2

Read more ›

Posted in Database Health Tagged with: , , , , ,

Newsletter Signup

Stay informed of Database Corruption Challenge events, and other things happening at SteveStedman.com with my newsletter.
Newsletter signup form.

Stedman Solutions

StedmanSolutionsRemoteSkilledDBA