Corrupt database question?

  • We have a table (> 4,000,000 rows) that appears to be missing data, but if we copy the table using "insert into new_table from bad_table" some of the missing data mysteriously reappears. I am assuming there is something wrong with the database, but I don't know where to begin. Can anyone give me some idea of what might be wrong?

    Also, I performed a "select count(1) from bad_table" and received a count.  I then performed a "select field1, count(1) from bad_table group by field1" and received a different answer (field1 is not nullable).

    Thanks in advance!

  • Did you already try DBCC CHECKDB?

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

  • Also, make a quick check that your not critical on drive space, especially where Temp DB is located. This can cause very very  strange results (errors) on other "good" databases. Franks suggestion is good a start of a good path to go down, you should take advantage of what SQL Srv offers in this regard. DBCC CHECK... will return "bogus" information however if TempDB itself is having problems. So make sure your PC is in "good" order prior to trying to "fix" any SQL problem.

    Are any other "bad" symtoms happening on the PC, either within SQL or in non-SQL operations?

     



    Once you understand the BITs, all the pieces come together

  • DBA suspected corrupt index, so he dropped the index (on field1 in the example).  We reran the query with the "group by" ("select field1, count(1) from bad_table group by field1") and it returned the same count as the "vanilla" query ("select count(1) from bad_table").  DBA is re-building the index.

    DBA will also be running DBCC check also, per your recommendations.

    Thank you for the responses.

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

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