Showing posts with label throwing. Show all posts
Showing posts with label throwing. Show all posts

Friday, March 9, 2012

inconsistency errors and how to fix them?

One of the db's I support is prone to throwing up inconsistency errors from time to time. The latest problem seems to relate to indexes.

Server: Msg 2511, Level 16, State 1, Line 1
Table error: Object ID 645577338, Index ID 3. Keys out of order on page (1:286818), slots 308 and 309.
Server: Msg 2511, Level 16, State 1, Line 1
Table error: Object ID 645577338, Index ID 3. Keys out of order on page (1:286826), slots 308 and 309.
DBCC results for 'OrderItem'.
There are 9973753 rows in 67394 pages for object 'OrderItem'.
CHECKTABLE found 0 allocation errors and 2 consistency errors in table 'OrderItem' (object ID 645577338).
repair_rebuild is the minimum repair level for the errors found by DBCC CHECKTABLE (Iceland.dbo.OrderItem ).

I could run a DBCC checktable with the options that *might* fix the above. I am also thinking about doing an index rebuild (currently a nightly index defrag is done but no schedule for an index rebuild is in place). Another table is involved. Both table are reasonably large (one is 7 million rows and the other is nearly 10 million rows). These tables are involved in a chain of many to many relationships. I don't know if it's a factor but the chain is circular. However, this doesn't seem to cause problem in other dbs that have the same design.

What would be the recommended approach for:-

a) fixing the current db inconsistencies?
b) finding the underlying cause of the problem to stop it from happening again?

Thank in advance,

CliveMicrosoft Knowledge Base Article - 822747