Solved

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

Posted on 2014-09-26
3
127 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Server Deadlocks 12 50
SQL Exceptions 3 39
TSQL case statement when a value is in the column more than 1 time 7 31
recover sqlserver db 8 56
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

867 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now