Online index rebuild corruption bug in SQL Server 2012 SP1

This is a quick blog post to let you know about a bug in SQL Server 2012 SP1 that can cause data loss when performing index maintenance.

The data loss issue can happen in some circumstances when you do a parallel online rebuild of a clustered index while there are concurrent data modifications happening on the table AND you also hit a deadlock and another error. Nasty when it occurs, but that should hopefully be a rare combination.

The workaround is to limit the online rebuild operation to be single threaded using the WITH (MAXDOP = 1) option.

There is a hotfix available – see KB 2969896 for more details.

Depending on which build you are on of SQL Server 2012 or 2014, the best option for you will vary. See my friend Aaron Bertrand’s post for comprehensive details.

14 thoughts on “Online index rebuild corruption bug in SQL Server 2012 SP1

    1. This is not fixed in SP2 (11.0.5058). And if you apply the SP1 hotfix and then apply SP2, you will lose the benefit of the hotfix. For SP2 you will need to wait for the first cumulative update (currently scheduled for end of July).

  1. Would this get picked up by an integrity check? I am assuming that non clustered indexes at least would report failure as their clustered index entry would be missing.

    Thanks.

  2. We’ve been doing rebuilds with MAXDOP 1 for some time so aren’t exposed to this. This reason we moved to MAXDOP 1 was because of our use of GUIDs. An ONLINE REBUILD made the fragmentation worse using SQL 2K12 SP1.

Leave a Reply

Your email address will not be published. Required fields are marked *

Other articles

Some thoughts on courage

(This is also the Ponderings – editorial – in today’s SQLskills newsletter.) I want to start out this post by sincerely thanking everyone who emailed

Explore

Imagine feeling confident enough to handle whatever your database throws at you.

With training and consulting from SQLskills, you’ll be able to solve big problems, elevate your team’s capacity, and take control of your data career.