今天在Detach資料庫的時候出現錯誤,運行DBCC CHECKDB從SQL Server error log中看到下面的資訊:
Error: 17053, Severity: 16, State: 1.
LogWriter: Operating system error 21(The device is not ready.)encountered.
Write error during log flush.
Error: 9001, Severity: 21, State: 4.
The log for database '' is not available.Check the event log for related error messages. Resolve any errors and restartthe database.
Error: 823, Severity: 24, State: 2.
The operating system returned error 21(The device is not ready.) to SQLServer during a read at offset 0x000000000de000 in file 'xx.mdf'. Additional messages in the SQL Server error log and system eventlog may provide more detail. This is a severe system-level error condition thatthreatens database integrity and must be corrected immediately. Complete a fulldatabase consistency check (DBCC CHECKDB). This error can be caused by manyfactors; for more information, see SQL Server Books Online.
根據錯誤21那麼應該是磁碟的問題,但是這個磁碟上面放著很多其他的資料庫都是可以正常工作的,而且新建立檔案都沒有問題。
之後看到823的錯誤,這個應該是硬體錯誤導致的。微軟給出的建議是運行DBCC CHECKDB。但是根本無法運行。
嘗試運行DBCC CHECKDB WITH TABLOCK仍然報上面的錯誤。
之後嘗試重啟了一次服務,資料庫竟然好了。運行DBCC CHECKDB沒有發現錯誤。
感覺這個問題很妖怪,在硬體磁碟都沒有問題的情況下竟然報磁碟錯誤。
本文出自 “關注SQL Server技術” 部落格,請務必保留此出處http://lzf328.blog.51cto.com/1196996/1294871