Solved

Rebuild Index on SQL 2000 Database fails due to duplicate key found - how to resolve?

Posted on 2014-09-26
3
135 Views
Last Modified: 2015-01-09
I have a SQL 2000 database that is throwing a lot of errors after a checkdb. I've attempted to run a CHECKDB Repair_Rebuild which failed. Here are the first 30 or so lines of the log:

Server: Msg 1505, Level 16, State 1, Line 1
CREATE UNIQUE INDEX terminated because a duplicate key was found for index ID 1. Most significant primary key is '95556616'.
Server: Msg 8978, Level 16, State 1, Line 1
Table error: Object ID 741577680, index ID 1. Page (1:15544819) is missing a reference from previous page (1:15544816). Possible chain linkage problem.
Server: Msg 8935, Level 16, State 1, Line 1
Table error: Object ID 741577680, index ID 1. The previous link (1:6231350) on page (1:15774924) does not match the previous page (1:15776528) that the parent (1:9225193), slot 71 expects for this page.
Server: Msg 8937, Level 16, State 1, Line 1
Table error: Object ID 741577680, index ID 1. B-tree page (1:15774924) has two parent nodes (0:1), slot 0 and (4:4173), slot 4.
Server: Msg 8937, Level 16, State 1, Line 1
Table error: Object ID 741577680, index ID 1. B-tree page (1:15774925) has two parent nodes (1:9540125), slot 98 and (1:9225193), slot 1.
Server: Msg 8937, Level 16, State 1, Line 1
Table error: Object ID 741577680, index ID 1. B-tree page (1:15774926) has two parent nodes (1:9540125), slot 97 and (1:9225193), slot 1.
Server: Msg 8937, Level 16, State 1, Line 1
Table error: Object ID 741577680, index ID 1. B-tree page (1:15774927) has two parent nodes (1:9540125), slot 101 and (1:9225193), slot 1.
Server: Msg 8978, Level 16, State 1, Line 1
Table error: Object ID 741577680, index ID 1. Page (1:15776528) is missing a reference from previous page (1:15774925). Possible chain linkage problem.
DBCC results for 'MyTable'.
        Repairing this error requires other errors to be corrected first.
        Repairing this error requires other errors to be corrected first.
        Repairing this error requires other errors to be corrected first.
        Repairing this error requires other errors to be corrected first.
        Repairing this error requires other errors to be corrected first.
        Repairing this error requires other errors to be corrected first.


I don't understand how it's possible that a unique index can have duplicate keys - shouldn't SQL have refused the insert since it wasn't unique?

How can I get this index rebuilt?
0
Comment
Question by:KThrace
  • 2
3 Comments
 
LVL 33

Accepted Solution

by:
ste5an earned 500 total points
ID: 40346379
Nope, due the problems reported by CHECKDB, data corruption has occured. Thus the only way is to rebuild this table.
0
 

Author Comment

by:KThrace
ID: 40346397
Understood. Which involves exporting the data, recreating the table, and then importing the data.

Am I not then going to run into problems with the non unique values? I still don't understand how duplicate keys got into the table...
0
 
LVL 33

Expert Comment

by:ste5an
ID: 40346727
The corruption may have affected the primary key. Thus bypassing the uniqueness check. Anorher possible reason: the corruption created the duplicate valuė.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question