Solved

rebuild does not fix NC index error

Posted on 2013-01-22
5
457 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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

Suggested Solutions

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
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.
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…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

911 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

22 Experts available now in Live!

Get 1:1 Help Now