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
Category:
SQL Development, SQL Server DBA
|
Author:
Chreddy Sure |
Published On:
25 May 2026
While connecting to SQL Server, users may sometimes encounter the following error:
“A network-related or instance-specific error occurred while establishing a connection to SQL Server...”
This issue usually happens due to incorrect server details, SQL Server service issues, network problems, or permission-related errors. In this article, we will look at common SQL Server connection errors and their possible solutions.
Error 1: A Network-Related or Instance-Specific Error Occurred
Error Message:
“A network-related or instance-specific error occurred while establishing a connection to SQL Server...”
Possible Reasons:
1. Incorrect Server Name
Make sure the SQL Server name or instance name entered in the connection string or SSMS is correct.
2. SQL Server Service Not Running
The SQL Server Database Engine service may not be in the RUNNING state.
Solution
Open SQL Server Configuration Manager or Services
Check the status of:
SQL Server
SQL Server Browser
Start the services if they are stopped
3. Network Connectivity Issues
There may be a network-related issue between the client machine and the SQL Server.
Solution
Verify network connectivity
Ping the server
Check firewall settings
Ensure the SQL Server port is open
Error 2: Login Failed for User
Error Message
“Login failed for user 'peter'. (Framework Microsoft SqlClient Data Provider). Error Number: 18456”
Reason
This error generally occurs due to insufficient permissions or invalid login credentials.
Solution
Contact the Database Administrator (DBA) and ensure:
The user account has proper access permissions
SQL authentication is enabled (if required)
The login is mapped to the required database
Error 3: SSL Certificate Trust Issue
Error Message:
“A connection was successfully established with the server, but then an error occurred during the login process.
(provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)
(Framework Microsoft SqlClient Data Provider)”
Reason:
This issue occurs because the SSL certificate used by SQL Server is not trusted by the client machine.
Solution:
You can temporarily disable encrypted connections in SQL Server Management Studio (SSMS).
Steps to Fix
Open SQL Server Management Studio (SSMS)
In the login window, click Options
Go to the Connection Properties tab
Uncheck the option:
Encrypt Connection
Click Connect
Read More