How to Fix SQL Server Error 945 (Msg 945)

Published
Length
3 min read

Luis Felipe Dias

All posts

Missing files, low memory, or a full disk trigger sql server error 945. You fix it by freeing disk space, restoring file rights, and bringing the database online. This failure is a severity 16 message in the database engine. The server reports that the database cannot open because files are missing or resources are low. It points admins to the main error log for the exact failure cause. When this happens, the database enters a recovery pending state and blocks all queries. What causes sql ser

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.

Missing files, low memory, or a full disk trigger sql server error 945. You fix it by freeing disk space, restoring file rights, and bringing the database online.

This failure is a severity 16 message in the database engine. The server reports that the database cannot open because files are missing or resources are low. It points admins to the main error log for the exact failure cause. When this happens, the database enters a recovery pending state and blocks all queries.

What causes sql server error 945 in the engine

The database engine needs access to data files and transaction log files at startup. It also checks these files when a database comes online or finishes a restore. If the engine cannot read or write to these files, it throws message 945.

Full storage volumes are the most common cause for this error in production. Transaction logs grow during large write jobs until the disk has zero free bytes. When the engine tries to run recovery, it needs extra space to roll back open work. Without that disk space, the startup step stops and raises message 945.

File permission changes on the host operating system also cause this failure. The service account running the database engine must hold read and write rights on all folders. Sometimes a team moves files to a new drive or updates folder security rules. If the service account loses folder rights, the engine marks the files as inaccessible.

Antivirus tools or backup apps can also lock database files on the disk. When another program holds an exclusive lock, the database engine cannot open the file. Low server memory is a third root cause listed in the official error text. If the host runs out of memory, the engine cannot build internal structures to open the database.

How to diagnose and fix the failure in production

Start your check by reading the database error log on the server. Message 945 is a summary message that tells you a database failed to open. The lines right before it in the log show the real operating system error. Look for notes about full disks, missing paths, or access denied errors.

Kubernetes API Server Access + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

If the log shows a full disk, clear old backup files or temp files first. You can also expand the storage volume or add a second log file on another drive. Once the drive has free space, tell the engine to bring the database online. The engine will finish its recovery steps and open the database for work.

If the log shows an access denied message, check the folder security rules. Make sure the database service account has full rights on the data and log folders. Do not fix this by running the database service as a full system admin. Grant folder rights only to the specific service account for that instance.

Keep database roles tight while you check and fix the server state. A database user is the identity of a login when it connects to a database. For people who need access to many databases, a login in master is common. Do not hand out the owner role to developers just to check database status. That owner role can change all settings and even drop the database.

Instead, grant read roles once the database is back online and healthy. Members of the fixed read role can read all data from user tables and views. You cannot change the rights built into fixed database roles. When engineers query production to verify data after a crash, apply data masking too. Masking rewrites matched fields like emails, phone numbers, card numbers, and national IDs in 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 16 mean for message 945?

Severity 16 means the error comes from a problem that an admin or user can fix. It does not mean the database software itself has a broken engine bug. You can resolve it by fixing disk space, memory, or file path rights.

Does sql server error 945 mean my data is corrupt?

No, this error usually means the engine cannot reach the files or lacks disk space. The database stays in a recovery pending state until you fix the storage issue. Once you restore file access or free space, the database opens without data loss.

Can a read-only user fix message 945?

No, a user in the fixed read role can only read user tables and views. Fixing this error requires host storage access and server-level rights to bring the database online. Only admins with server state and alter database rights can complete the recovery.

The query runs. The emails stay hidden.