我们将备份恢复到新数据库中。运行一些删除查询后,我们收到以下消息:
消息 824,级别 24,状态 2,第 1 行 SQL Server 检测到基于逻辑一致性的 I/O 错误:...
我运行 DBCC checkdb 并看到许多行,例如:
Msg 2576, Level 16, State 1, Line 1
The Index Allocation Map (IAM) page (0:0) is pointed to by the previous pointer of IAM page (1:783) in object ID 0, index ID -1, partition ID 0, alloc unit ID 72057599497994240 (type Unknown), but it was not detected in the scan.
和
Msg 8939, Level 16, State 98, Line 1
Table error: Object ID 2083043448, index ID 1, partition ID 72057608168079360, alloc unit ID 72057608304721920 (type LOB data), page (1:307605). Test (IS_OFF (BUF_IOERR, pBUF->bstat)) failed. Values are 12716041 and -4.
Msg 8965, Level 16, State 1, Line 1
Table error: Object ID 2083043448, index ID 1, partition ID 72057608168079360, alloc unit ID 72057608304721920 (type LOB data). The off-row data node at page (1:307605), slot 0, text ID 1368915968 is referenced by page (1:307603), slot 0, but was not seen in the scan.
Msg 8965, Level 16, State 1, Line 1
Table error: Object ID 2083043448, index ID 1, partition ID 72057608168079360, alloc unit ID 72057608304721920 (type LOB data). The off-row data node at page (1:307605), slot 1, text ID 903086080 is referenced by page (1:307648), slot 0, but was not seen in the scan.
Msg 8929, Level 16, State 1, Line 1
Object ID 2083043448, index ID 1, partition ID 72057608168079360, alloc unit ID 72057609480241152 (type In-row data): Errors found in off-row data with ID 1368915968 owned by data record identified by RID = (1:43506:13)
Msg 8929, Level 16, State 1, Line 1
Object ID 2083043448, index ID 1, partition ID 72057608168079360, alloc unit ID 72057609480241152 (type In-row data): Errors found in off-row data with ID 903086080 owned by data record identified by RID = (1:102876:38)
输出的最后一部分是:
CHECKDB found 1 allocation errors and 12 consistency errors in database 'Clients'.
repair_allow_data_loss is the minimum repair level for the errors found by DBCC CHECKDB (Clients).
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
我的问题是:我应该尝试再次恢复数据库还是继续尝试修复?我只是犹豫,因为它是一个相当大的数据库并且恢复需要很长时间。
更新:更多信息。
所有表错误都与我可以删除并重新创建的单个表有关。但是我不明白 IAM 错误的真正含义或其影响。
我可能会两者都做,但将其恢复为新名称。
如果该表中的数据真的、真的无关紧要,并且您真的、真的可以删除并重新创建该表,那可能是最快的选择。特别是因为“repair_allow_data_loss”可能会导致数据丢失,是的。
至于IAM错误是什么意思:
简短版本:您的表内部已损坏。
更长的版本:Index Allocation Map 告诉 SQL Server 从哪里获取实际对象。在这种情况下,根据对 RID 的引用,我猜测这是一个没有聚集索引的表(换句话说,一个堆),它告诉 SQL 从哪里获取堆内主动更新的数据。(当堆有更新时发生的事情之一是,如果新信息不适合旧空间,则会创建一个指针,告诉 SQL 从哪里获取新信息。)
这是一篇关于 IAM 页面的文章,这是我在为您寻找 IAM 信息时出现的有关 SQL Server 中堆的精彩视频。