Solved

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

Posted on 2014-09-26
3
139 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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 stored procedure parameter 10 20
SQL Pivot table 2 42
How to keep a record with the highest value 3 38
T-SQL Query - Group By Year 3 28
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

762 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