今天在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没有发现错误。
感觉这个问题很妖怪,在硬件磁盘都没有问题的情况下竟然报磁盘错误。
本文转自 lzf328 51CTO博客,原文链接:
http://blog.51cto.com/lzf328/1294871