Category:
PLSQL, SQL Development, SQL Server DBA
|
Author:
Chreddy Sure |
Published On:
27 May 2026
When we are working with MS SQL Server databases, we are getting the following error in some of the SQL Server instances.
Msg 823, Level 24, State 2, Line 2 The operating system returned error 21(The device is not ready.) to SQL Server during a read at offset 0x00000000056000 in file 'E:\SQLDEV22\databasefiles\crystalspidersinst_0700.mdf'. Additional messages in the SQL Server error log and operating system error 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.
This is one of the major issue at Microsoft SQL Server storage-level.
Quick Remedy: Restart the SQL Server service
The error means SQL Server is trying to read the MDF file from disk E: but Windows unable to access the disk/device properly.
The reasons are as follows:
The drive may be disconnected
External HDD/SSD failure
Disk has corruption
VM mounted disk issue
Storage controller issue
Bad sectors
Antivirus or any other software locked the file
Let's start step by step troubleshoot:
Step 1 — Check the Windows Disk
Open Command Prompt as Administrator, run the following command to check and repair the bad sectors. I am assuming it is E: drive has database files.
/> chkdsk E: /f /r
Step 2 — Run DBCC CHECKDB command
If the database is online, then run the following command. Replace the database name with your actual database name.
DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS;
If the database is in SUSPECT state, then run the following commands.
ALTER DATABASE YourDatabaseName SET EMERGENCY;
ALTER DATABASE YourDatabaseName SET SINGLE_USER;
DBCC CHECKDB ('YourDatabaseName', REPAIR_ALLOW_DATA_LOSS);
ALTER DATABASE YourDatabaseName SET MULTI_USER;
Thank you
Read More