[SQL]SQL Error 824, SQL Server detected a logical consistency-based I/O error: torn page
今天在執行一支stored procedure時,居然發生如下的錯誤,
SqlException.Number=824
[ERROR] .Net SqlClient Data ProviderSystem.Data.SqlClient.SqlException: SQL Server detected a logical consistency-based I/O error: torn page (expected signature: 0x55555555; actual signature: 0x55555565).
It occurred during a read of page (1:557077) in database ID 7 at offset 0x0000011002a000 in file 'D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\yourdb.mdf'.
Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe 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.
看來是要修復這個DB了,所以參考「SQL Server detected a logical consistency-based I/O error」這篇,
重新修復DB就好了!
alter database yourdb SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
--執行DB修復(嘗試修復所有報告的錯誤。 這些修復可能會造成某些資料的遺失。)
DBCC CHECKDB('yourdb', REPAIR_ALLOW_DATA_LOSS);
--執行修復後再將DB切回到 MULTI_USER 模式
alter database yourdb SET MULTI_USER;
請注意,執行DB修復之前,請先備份資料庫哦!
上次這樣執行後,今天(2013/01/15)在操作系統時,於是跟公司MIS Wilson討論,他說一般會出現這種情況,大多是因為異常的關機所造成。
但是上次修復過了,居然又出現相同的錯誤! 查了一下事件檢視器,居然有Disk的Error,那這可能是Disk真的有問題吧!
所以就趕快通知客戶進行處理~~
參考資訊
DBCC CHECKDB and REPAIR_ALLOW_DATA_LOSS with MSSQL
Hi,
亂馬客Blog已移到了 「亂馬客 : Re:從零開始的軟體開發生活」
請大家繼續支持 ^_^