我的两个数据库的夜间维护计划失败了。我甚至不知道这意味着什么。有什么解决办法吗?
这是我从维护计划中发现的错误:
Executing the query "DBCC CHECKDB(N'Site_DB') WITH NO_INFOMSGS
" failed with the following error: "The Index Allocation Map (IAM) page (0:0) is pointed to by the previous pointer of IAM page (1:747) in object ID 0, index ID -1, partition ID 0, alloc unit ID 72057597046816768 (type Unknown), but it was not detected in the scan.
CHECKDB found 1 allocation errors and 0 consistency errors not associated with any single object.
CHECKDB found 1 allocation errors and 0 consistency errors in database 'Site_DB'.
repair_allow_data_loss is the minimum repair level for the errors found by DBCC CHECKDB (Site_DB).". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
有趣的是,两个不同的数据库报告了完全相同的页面 ID。不知道为什么会这样。
答案1
我遇到了一个文章它提供了一些关于如何解决问题的提示。
因此我运行了以下命令:
DBCC TRACEON(3604,-1)
GO
DBCC PAGE('Site_DB', 1, 747, 3)
Metadata: IndexId 值结果为 -1。文章说,如果结果大于 1,则删除并重新创建非聚集索引。如果结果为 0 或 1,则从备份中恢复或尝试修复。不幸的是,这两种情况都不涵盖 -1 值...
于是我继续跑
DBCC CHECKDB('Site_DB', REPAIR_ALLOW_DATA_LOSS) WITH NO_INFOMSGS, ALL_ERRORMSGS
返回结果显示已发现分配错误并已修复。为了确保万无一失,我再次运行了 DBCC CHECKDB('SiteDB') WITH NO_INFOMSGS,结果显示一切正常。