Table Corruption

  • I have a table with 6.6 million records, 333 columns with insert and select operations against it.  No update or delete.  No cluster index, just some non-clustered indexes.  New records inserted at a rate of 30 per minute 24x7 non-stop. Every week or so, we alter table to add about 1 column.

    We hv table corruption on average once every 2 months and will do dbcc checktable to repair.

    My questions.

    1. How can i prevent corruption on the table ? Any good practices or recommendations ?  We hv full design control on the table.

    2. How to interpret the results from the dbcc checktable command below?

    Server: Msg 8977, Level 16, State 1, Line 1

    Table error: Object ID 1665193478, index ID 1. Parent node for page (3:426169) was not encountered.

    Server: Msg 8977, Level 16, State 1, Line 1

    Table error: Object ID 1665193478, index ID 1. Parent node for page (3:426170) was not encountered.

    Server: Msg 8977, Level 16, State 1, Line 1

    Table error: Object ID 1665193478, index ID 1. Parent node for page (3:426171) was not encountered.

    Server: Msg 8977, Level 16, State 1, Line 1

    Table error: Object ID 1665193478, index ID 1. Parent node for page (3:426172) was not encountered.

    Server: Msg 8977, Level 16, State 1, Line 1

    Table error: Object ID 1665193478, index ID 1. Parent node for page (3:426173) was not encountered.

    Server: Msg 8977, Level 16, State 1, Line 1

    Table error: Object ID 1665193478, index ID 1. Parent node for page (3:426174) was not encountered.

    Server: Msg 8977, Level 16, State 1, Line 1

    Table error: Object ID 1665193478, index ID 1. Parent node for page (3:426175) was not encountered.

    Server: Msg 8986, Level 16, State 1, Line 1

    Too many errors found (201) for object ID 1665193478. To see all error messages rerun the statement using "WITH ALL_ERRORMSGS".

            The error has been repaired.

            The error has been repaired.

            The error has been repaired.

            The error has been repaired.

            The error has been repaired.

            The error has been repaired.

            The error has been repaired.

    Repair: Page (3:426265) has been deallocated from object ID 1665193478, index ID 0.

    Repair: Page (3:967876) has been deallocated from object ID 1665193478, index ID 0.

    Clustered index successfully restored for object 'dbo.module' in database 'LogDatabase'.

    There are 6623014 rows in 2252109 pages for object 'module'.

    CHECKTABLE found 0 allocation errors and 294 consistency errors in table 'module' (object ID 1665193478).

    CHECKTABLE fixed 0 allocation errors and 294 consistency errors in table 'module' (object ID 1665193478).

    Thanx........

     

  • 1: You can't prevent corruption, since you never know when your hardware will fail. That's no question of if, but rather when. Best thing is to nake sure you have a good backup and disaster recovery strategy.

    2: Table error: Object ID 1665193478, index ID 1.

    Index ID 1 *is* a clustered index. And since this index is actually the data in that table, I would call MS PSS to help you here. You might also check your hardware.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • 1. yes, u are right.  I didnt realise that creating a primary key in EM will automatically create a clustered index.

    2. The columns we chose for clustered index is not ideal and will cause a lot of page splits.  Will high activity of page splits and add columns caused corruptions ?

    thanx....

  • Lots of page splits could lead to corruption being more likely.

    Have you looked at the fillfactor on the indexes and the pad_index factor. This will reduce page splits.

    Do you reindex on a regular basis. This may also help reduce possible corruption

  • Creating a PRIMARY KEY without explicitely specifying NONCLUSTERED, will always create a CLUSTERED PK in SQL Server.

    See if this provides additional help: http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/ss2kidbp.mspx

    Just reread your first post here. May I say that 333 columns in a single table is pretty much. Don't know if this is OLAP stuff, but if it is not, one might think that that table isn't very normalized at all. Might also be worth to keep in mind.

    And why do you add another column every week? What the reason for this?

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • We collect parametric data from testers running home-built software.  Since we introduce many new products, new parametric data needs to be collected.

    WHile total columns is 333, on average about 100 different columns are populated, the rests are null.

    We did DBCC SHOWCONTIG and results attached below.

    The indexes were rebuild some 3 weeks back but it is now highly fragmented.

    We suspected our choice of columns for clustered index is not optimum. 

    we plan to create new column, populate it with running number and make it clustered index.  Since record size is 2.5K +/- 0.2K, is there any way to tell SQLServer to allocate say 2 records only per page OR maybe i have to use fillfactor of say 70% ?  Any ideas ?

    thanx.....

    ObjectNameIndexNameIndexIdPagesRowsMinimumRecordSizeMaximumRecordSizeAverageRecordSizeForwardedRecordsExtentsExtentSwitchesAverageFreeBytesAveragePageDensityScanDensityBestCountActualCountLogicalFragmentationExtentFragmentation
    modulePK_module1_new122492876708400238026042538.0660282224327276520.493.685.92811613272771.20.5
    modulefidx_station2396826708400306339.34205007108041106.886.345.949611080591.812.9
    modulefidx_WhichTest3379466708400256736.5104790162521287.784.129.247441625382.723.0
    modulefidx_TStamp419990670840094320025143607713.091.269.32499360884.516.7
    modulefidx_ModulePartNum5408626708400296440.8640515098911058.986.951.65108989293.212.0
    moduleidx_operator6322806708400225531.00904068137791236.084.729.340351378083.022.6
    moduleoba7438026708400277744.520553815797971.388.034.754761579886.519.6
    moduleidx_Result828557670840016502703596120721283.584.129.635701207382.823.2
    moduleidx_Module_Type9326936708400125131.61904124131241197.585.231.140871312583.922.1
  • Wow... 230+ NULL columns to me screams for some data normalization.  Pull those columns that are typically NULL out into their own tables (one or more) with the same PK as the main table.  Then instead of having a bunch of NULL columns in your main table, when that data doesn't apply to your record, you just don't create a record in the "linked" tables.  While this may be a lot of work I bet it would help performance tremendously...

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply