Solved

rebuild does not fix NC index error

Posted on 2013-01-22
5
462 Views
Last Modified: 2013-01-23
my understanding is NC index can be easily fixed in data corruption.. but what may block easy rebuild of such a case?
0
Comment
Question by:25112
  • 4
5 Comments
 
LVL 5

Author Comment

by:25112
ID: 38806047
Table error: table 'OptionsReview' (ID 329820287). Data row does not have a matching index row in the index 'NdxOptionsReviewA' (ID 3). Possible missing or invalid keys for the index row matching:
Msg 8955, Level 16, State 1, Line 2
Data row (1:98012:58) identified by (HEAP RID = (1:98012:58)) with index values 'OptionsReviewID = 4146 and HEAP RID = (1:98012:58)'.

NdxOptionsReviewA is a non-clustered non-unique index on OptionsReviewID.

I rebuilt the index NdxOptionsReviewA, but I still get the same error when I run dbcc checkdb or checktable.
0
 
LVL 5

Author Comment

by:25112
ID: 38806095
The funny thing is if I run DBCC CHECKTABLE (OptionsReview) then I get the below:

DBCC results for 'OptionsReview'.
There are 217112 rows in 2332 pages for object "OptionsReview".
DBCC execution completed. If DBCC printed error messages, contact your system administrator.

but
DBCC CHECKDB (POPT) WITH NO_INFOMSGS, ALL_ERRORMSGS
brings back the same errors for this table.
0
 
LVL 5

Author Comment

by:25112
ID: 38806154
i dropped the index and then there is no errors with
DBCC CHECKDB (POPT) WITH NO_INFOMSGS, ALL_ERRORMSGS for that table..

but i recreate that index, then i get the error back.

does that mean the problem is data and not index even though the error message seems to indicate so? what would you recommend for this?
0
 
LVL 69

Accepted Solution

by:
Scott Pletcher earned 500 total points
ID: 38807926
Heaps can become so "scattered" over time that it can cause issues.

If the table is not too large / can afford the down time (or you have Enterprise+ edition and can do the index changes ONLINE), I'd suggest you try this:

1) Review sys.dm_db_index_usage_stats for that table and see if any NC index could make a good Clus index.
2) Script out all existing NC indexes.
3) Drop all NC indexes.
4) Create a clustered index.
5) OPTIONAL: Drop the clustered index.
6) Recreate all NC indexes, unless that key(s) became the clustered index.
0
 
LVL 5

Author Comment

by:25112
ID: 38810643
100% Right on..thanks Scott..

create CI once did it.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how the fundamental information of how to create a table.

685 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