Error: 17053 LogWriter: Operating system error 21(The device is not ready.)

今天在Detach数据库的时候出现错误,运行DBCC CHECKDBSQL 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没有发现错误。

 

感觉这个问题很妖怪,在硬件磁盘都没有问题的情况下竟然报磁盘错误。

原文地址:https://www.cnblogs.com/keanuyaoo/p/3310861.html