How to Fix SQL Server Error 905 (Msg 905)

Published
Length
3 min read

Luis Felipe Dias

All posts

You see sql server error 905 when a database will not start on your instance. This happens because the database contains a partition function that your edition does not support. To fix this issue, restore the database on an edition that supports partitioning. You can also remove the partition function on the source server before moving the database. Root causes of sql server error 905 in the engine In the database engine, message 905 carries a severity level of 21. A severity 21 error means

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.

You see sql server error 905 when a database will not start on your instance. This happens because the database contains a partition function that your edition does not support.

To fix this issue, restore the database on an edition that supports partitioning. You can also remove the partition function on the source server before moving the database.

Root causes of sql server error 905 in the engine

In the database engine, message 905 carries a severity level of 21. A severity 21 error means the engine found a critical problem during startup.

The official message states that the database cannot start in the current edition. It names both the database and the specific partition function that blocked the start.

Teams often see this error during migrations, disaster recovery drills, or test restores. An engineer backs up a production database that uses table or index partitioning. Next, they try to restore or attach that backup onto a lower server edition.

When the engine runs startup recovery, it reads the internal metadata of the database. It checks every object against the feature list of the host instance. When it finds a partition function on an unsupported edition, it stops recovery right away.

The database stays offline or in a failed recovery state until you act. Client apps cannot read or write data while the database is in this state.

How to diagnose and fix the failure in production

Start by reading the server error log to find the exact details. The log entry for message 905 lists the database name and the partition function name.

Once you know the object name, you have two safe paths to fix it. First, you can move the backup to a server edition that supports partition functions. This path keeps your schema intact and needs no structural changes to your tables.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Second, you can open the database on the original source server and change it. There, an admin can merge the partitions and drop the partition schemes and functions. After the partition function is gone, take a fresh backup for the target server.

During these steps, keep strict control over who can log in and make changes. A database user is the identity of a login when it connects to a database. If a person needs access to many databases, a login in master is common. For one or a few databases, you can use a contained database user instead.

Avoid giving every responder the db_owner role during an incident. A member of db_owner can run all maintenance tasks and even drop the database. Instead, give responders who only inspect data the db_datareader fixed role. Members of db_datareader can read all data from all user tables and views.

Note that you cannot change the permissions assigned to fixed database roles. If you must block a user from reading tables, use the db_denydatareader role.

Preventing edition mismatches across your servers

You can stop error 905 before it hits your team during an outage. Keep your test, staging, and recovery instances on matching editions whenever you can.

Before you move a database to a lower edition, audit its internal objects first. Check system views on the source database for any partition functions or partition schemes. If a developer adds partitioning to a table, record that change in your release notes.

Also, test your backup and restore flow on your actual recovery hardware often. When you test restores early, you catch edition limits before a real crisis starts. Pair these checks with least-privilege roles and data masking for sensitive fields like emails or phone numbers. Masking rewrites matched fields in results so responders fix startup bugs without exposing private records.

Add runtime guardrails beside SQL Server

Role grants and network rules are needed setup for SQL Server. Still, an allowed user or agent tool can send a bad delete or read raw customer fields over a valid session. In practice, hoop.dev sits inline in the TDS protocol beside the database as a sidecar for your SQL Server. For every query an agent or human runs in production, hoop.dev decides whether to pass, mask, block, or escalate it for review.

With hoop.dev SQL Server controls, rules refuse banned statements before they run, hold risky queries for human review, and mask matched sensitive values in supported result columns in memory. Furthermore, hoop.dev holds SOC 2 Type II and generates evidence for HIPAA, PCI DSS, SOX, and GDPR audits. See the source on GitHub.

Frequently asked questions

What does severity 21 mean for sql server error 905?

Severity 21 indicates a serious error in a database process. For message 905, the engine stops starting the database because of the unsupported partition function.

Can I drop the partition function while the database fails to start?

No, you cannot run queries inside a database that will not start. You must open the database on a supported edition to remove the partition function.

Which role should engineers use to check tables before a migration?

Assign engineers to the db_datareader fixed database role for read-only checks. This role lets them read all user tables and views without changing any data.

The query runs. The emails stay hidden.