我有 SQL Server 2000,自从从 SP2 升级到 SP4 后,随机错误就开始发生了。主要是溢出错误,有时在 data type 中SqlDateTime
,有时在 data typenumeric
中。
例如,现在我有一个列1099511628.776
作为它的值,列类型decimal(18,3)
最多可以容纳 10^38,所以很明显这不是溢出,但是当我尝试更新该列并将其设置为 1 时,我得到错误Arithmetic overflow error converting numeric to data type
numeric
。
我DBCC CHECKDB
在数据库上运行,在第一个表的两个表中出现 6 个一致性错误:
Msg 8970, Level 16, State 1, Line 1
Row error: Object ID 578101100, index ID 0, page ID (1:24157), row ID 61.
Column 'wh_id' was created NOT NULL, but is NULL in the row.
第二张表:
Msg 8928, Level 16, State 1, Line 1
Object ID 933578364, index ID 0: Page (1:7160) could not be processed.
See other errors for details.
Msg 8939, Level 16, State 12, Line 1
Table error: Object ID 933578364, index ID 0, page (1:7160).
Test (*(((int*) &m_reservedB) + i) == 0) failed. Values are 0 and 65536.
Msg 8944, Level 16, State 2, Line 1
Table error: Object ID 933578364, index ID 0, page (1:7223), row 12.
Test (!(hdr->r_tagA & (VERSION_MASK | RECTAG_RESV_A | RECTAG_RESV_B))) failed.
Values are 17 and 193.`
Msg 8928, Level 16, State 1, Line 1
Object ID 933578364, index ID 0: Page (1:7254) could not be processed.
See other errors for details.`
Msg 8939, Level 16, State 106, Line 1
Table error: Object ID 933578364, index ID 0, page (1:7254).
Test (m_freeCnt == freeCnt) failed. Values are 2442 and 2444.`
现在对于第一个错误,我尝试运行查询:
SELECT *
FROM table1
WHERE wh_id IS NULL
但是,它返回零行。对于其余的错误,我不知道如何查询表以找到坏行。
我该如何修复这些一致性错误,它们是随机错误的原因吗?