How to Fix SQL Server Error 823 (Msg 823)
A sql server error 823 happens when the operating system fails a disk read or write. You fix it by checking storage hardware, inspecting system logs, and restoring damaged data pages. This failure is a severity 24 alert that points to a serious disk or file problem. When the database engine asks the operating system for a page, the storage layer returns an error. The engine stops the current task and drops the active session right away. Teams must act fast to protect data and find the broken ha
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
A sql server error 823 happens when the operating system fails a disk read or write. You fix it by checking storage hardware, inspecting system logs, and restoring damaged data pages.
This failure is a severity 24 alert that points to a serious disk or file problem. When the database engine asks the operating system for a page, the storage layer returns an error. The engine stops the current task and drops the active session right away. Teams must act fast to protect data and find the broken hardware or driver.
What causes sql server error 823 in your database
The database engine relies on the host operating system to read and write file blocks. In a sql server error 823 event, the operating system returns an error during an input or output call. The message shows the exact file path and the byte offset where the action failed. Because it is a severity 24 issue, the engine treats the storage path as unsafe.
Hardware damage is the most common reason for this storage error. A failing hard drive, a bad controller card, or a dropped storage network path will trigger it. Outdated storage drivers or firmware bugs can also drop read and write calls under heavy load. Sometimes, file system filters like antivirus tools lock a database file and block the engine.
File system corruption on the host volume can also break page reads at a specific offset. When the operating system cannot read the sector, it passes its own error code back to the database. The database error log and the system event log record extra details about that host failure. Checking both logs together shows whether the disk, driver, or network path failed first.
How to diagnose and fix the failure in production
Start by reading the database error log and the operating system event log. Find the exact file name, the byte offset, and the operating system error message. Share these details with your storage and host admins so they can test the disks. If an antivirus tool scans database folders, ask the host team to exclude those data files.
Once the storage team fixes the disk or driver path, check the database for damaged pages. Run a full database consistency check to see if the failed write left any broken tables. If the check finds damaged pages, restore those pages or the full database from a clean backup. Never skip consistency checks after a disk failure, even if the database comes back online.
Kubernetes API Server Access + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Keep permissions tight while your team investigates the broken database. Do not give every engineer the fixed database owner role during an outage. Members of that owner role can change all settings and can even drop the database. Instead, use the fixed data reader role for people who only need to read user tables and views.
How to reduce risk during recovery
When engineers inspect tables after a storage fault, they only need basic read access. A database user is the identity of a login when it connects to a database. For people who need access to one or a few databases, a contained database user is a good option. An admin must first enable contained databases on the server and the database.
You cannot change the permissions assigned to fixed database roles. If a team member must never read sensitive tables during a check, use the deny data reader role. If they must not change data while testing, add them to the deny data writer role. You can also set up data masking to rewrite emails, phone numbers, card numbers, and national IDs in query results.
Check SQL Server batches and results on the wire
SQL Server logins and roles decide who connects. They do not check what each TDS batch does or mask sensitive values in returned rows. With hoop.dev, you run an open-source proxy, a sidecar for your SQL Server, inline in the TDS wire protocol. On every batch an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.
Before a batch hits the server, hoop.dev guardrails refuse disallowed actions with a native TDS error or hold risky statements for approval. On the way back, hoop.dev data masking rewrites sensitive values in supported result columns in memory, and every decision is logged. Explore the MIT-licensed project on GitHub.
Frequently asked questions
What does severity 24 mean for sql server error 823?
Severity 24 marks a serious media or hardware failure in the database engine. It means the storage system failed an input or output request, and the engine often closes the connection.
How is error 823 different from a logical page error?
Error 823 means the operating system itself could not read or write the disk sector. A logical error happens when the operating system reads the disk fine, but the database page header is broken.
Should we give engineers the database owner role to check tables after error 823?
No, because that role can change all settings and drop the database. Give responders the fixed data reader role so they can read user tables and views without changing data.
Related guides
In this post