Sql-Server
消息 2534:DBCC CHECKDB 分配錯誤
我們最近將我們的 Intranet 生產數據庫從 SQL Server 2008 遷移到了 SQL Server 2008 R2 全新的伺服器。
由於 DBCC 錯誤(檢查數據庫完整性任務),備份作業自遷移以來一直失敗。
昨天我嘗試在生產數據庫上使用 repair_rebuild 選項執行 DBCC CHECKDB,隨後的 DBCC CHECKDB 沒有顯示錯誤。針對生產數據庫的 DBCC CHECKDB 再次顯示錯誤消息,備份已完成,但維護計劃當然失敗:我有(一長串)以下錯誤消息:
Table error: page (1:1100029), whose header indicates that it is allocated to object ID 373210913, index ID 1, partition ID 72057701886525440, alloc unit ID 72057702118457344 (type In-row data), is allocated by another object. Msg 2534, Level 16, State 2, Line 1 Table error: page (1:1100030), whose header indicates that it is allocated to object ID 373210913, index ID 1, partition ID 72057701886525440, alloc unit ID 72057702118457344 (type In-row data), is allocated by another object. Msg 7965, Level 16, State 1, Line 1 Table error: Could not check object ID 373210913, index ID 1, partition ID 72057701886525440, alloc unit ID 72057702118457344 (type In-row data) due to invalid allocation (IAM) page(s). Msg 2534, Level 16, State 2, Line 1 Table error: page (1:1100031), whose header indicates that it is allocated to object ID 373210913, index ID 1, partition ID 72057701886525440, alloc unit ID 72057702118457344 (type In-row data), is allocated by another object. Msg 2534, Level 16, State 2, Line 1 Table error: page (1:1100200), whose header indicates that it is allocated to object ID 373210913, index ID 1, partition ID 72057701886525440, alloc unit ID 72057702118457344 (type In-row data), is allocated by another object. Msg 2534, Level 16, State 2, Line 1 Table error: page (1:1100201), whose header indicates that it is allocated to object ID 373210913, index ID 1, partition ID 72057701886525440, alloc unit ID 72057702118457344 (type In-row data), is allocated by another object. There are 14 rows in 3 pages for object "searchfull_dummy_1049". CHECKDB found 0 allocation errors and 6 consistency errors in table 'searchfull_dummy_1049' (object ID 373210913). DBCC results for 'foldersRecherche'. There are 0 rows in 0 pages for object "foldersRecherche". DBCC results for 'wf'. There are 0 rows in 0 pages for object "wf". DBCC results for 'searchfull_dummy_1663'.
我嘗試使用昨天的備份,使用新的數據庫名稱在同一台伺服器上恢復數據庫,並在數據庫上執行 DBCC Update usage(0),然後 DBCC CHECKDB 在新恢復的數據庫上不再顯示錯誤。
我對生產數據庫應用了相同的過程,但這並沒有解決生產數據庫上的問題。我遇到與上述相同的錯誤。
如果順序是:
- DBCC CHECKDB 報告錯誤。
- REPAIR_REBUILD 修復了數據庫,沒有報告錯誤。
- DBCC CHECKDB 再次報錯。
您可能在陣列中出現故障或故障磁碟,或者 IO 子系統的某些其他組件損壞或損壞。就個人而言,我希望盡快關閉問題伺服器!
- 進行尾日誌備份。
- 將上次已知的良好完整備份和差異/日誌序列還原到不同的伺服器。
- 將服務切換到第二台伺服器。
- 獲取一個新的cuppa 並開始在問題伺服器上進行診斷。
附錄:問題的根本原因:
事實證明,我發現當我們使用 Diskeeper 時,我們(出於公司原因)仍在使用舊版本:14.0.896。在這個版本中,我們會遇到如下消息:
The operating system returned error 1784(failed to retrieve text for this error. Reason: 15100) to SQL Server during a write at offset 0x000000010a4000 in file 'D:\Application-Data\MSSQL\Data\<Database>.mdf:MSSQL_DBCC17'. Additional messages in the SQL Server error log and system event log may provide more detail. This is a severe system-level error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online. Msg 3313, Level 21, State 2, Server <Server>, Line 1 During redoing of a logged operation in database '<Database>', an error occurred at log record ID (2349664:1503:4). Typically, the specific failure is previously logged as an error in the Windows Event Log service. Restore the database from a full backup, or repair the database. Msg 1823, Level 16, State 1, Server <Server>, Line 1 A database snapshot cannot be created because it failed to start. Msg 1823, Level 16, State 2, Server <Server>, Line 1 A database snapshot cannot be created because it failed to start. Msg 7928, Level 16, State 1, Server <Server>, Line 1 The database snapshot for online checks could not be created. Either the reason is given in a previous error or one of the underlying volumes does not support sparse files or alternate streams. Attempting to get exclusive access to run checks offline. Msg 5030, Level 16, State 12, Server <Server>, Line 1 The database could not be exclusively locked to perform the operation. Msg 7926, Level 16, State 1, Server <Server>, Line 1 Check statement aborted. The database could not be checked as a database snapshot could not be created and the database or table could not be locked. See Books Online for details of when this behavior is expected and what workarounds exist. Also see previous errors for more details
在此處的 Paul Randal 的部落格上找到了解釋
在這裡找到 DiskKeeper Fix 的連結
有趣的關於數據庫碎片整理的 Diskeeper 白皮書在這裡