Solved

rebuild does not fix NC index error

Posted on 2013-01-22
5
454 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:
ScottPletcher 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

707 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

17 Experts available now in Live!

Get 1:1 Help Now