DBCC CheckDB The operating system returned error 21(The device is not ready.) [closed]

The operating system returned error 21(The device is not ready.) to SQL Server during a read at offset 0x0000000001c000 in file 'E:\SQL Database\S*****d\NewAdvWorks.mdf'. 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.


Solution 1:

What worked for me:

alter database [database_name] set offline

...wait a few seconds...

alter database [database_name] set online 

This is better than restarting SQL Server since restarting SQL Server takes all databases offline (not just the database that is inaccessible).

Solution 2:

I encountered this same error today. Restarting the SQL Server service fixed it.

The SQL Server Error log and the Windows Event Log showed the same error:

The operating system returned error 21(The device is not ready.) to SQL Server during a read at offset 0x00000000026000 in file 'blah.mdf'. 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.

And:

Error: 823, Severity: 24, State: 2

After reading Robert van den Berg's answer, I would try taking the database offline and then online first if you have other databases that you need to keep online.

Solution 3:

First read the logs that were indicated in the error message.

Then try resetting the server, then run the DBCC CheckDB again.