How to Fix SQL Server Error 1406 (Msg 1406)
You see sql server error 1406 when the engine cannot force service safely. To fix it, remove database mirroring and recover the database to gain access. This failure has a severity level of 16 in the database engine. It stops your team from bringing a mirrored database online through forced failover. When an outage hits your primary server, a broken failover blocks critical apps. You must understand why the engine blocks forced service before changing database states. What causes sql server e
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 1406 when the engine cannot force service safely. To fix it, remove database mirroring and recover the database to gain access.
This failure has a severity level of 16 in the database engine. It stops your team from bringing a mirrored database online through forced failover. When an outage hits your primary server, a broken failover blocks critical apps. You must understand why the engine blocks forced service before changing database states.
What causes sql server error 1406 in database mirroring
Database mirroring keeps two copies of a database on separate server instances. One server acts as the principal, and the other acts as the mirror. When the principal goes down, admins may try to force service to the mirror. Forced service brings the mirror online right away, even with unsent log records.
Still, the engine checks the state of the mirror before allowing forced service. If the mirror session is in a state that prevents safe forced failover, it stops. The engine then returns sql server error 1406 with a severity level of 16. The message states that the server is unable to force service safely. It instructs you to remove database mirroring and recover the database to gain access.
This safeguard stops you from corrupting the database or losing track of transactions. The mirror database stays in a restoring state while mirroring remains active. Users and apps cannot read or write data until you complete recovery.
How to diagnose and fix the failure in production
Start by checking whether the original principal server is truly offline or just unreachable. A brief network drop can make a healthy principal look dead to the mirror. If the principal is still running, fixing the network path resolves the outage safely. You will not need to force service or break the mirroring session.
If the principal server is lost for good, follow the official error message steps. First, remove database mirroring from the affected database on the mirror server. Removing mirroring stops the relationship between the two server instances for that database. Next, run a database recovery action on the former mirror database. Recovery rolls forward completed work, rolls back open changes, and brings the database 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.
Once the database is online, check how your users log in to the server. A database user is the identity of a login when it connects. If you use SQL logins stored in the master database, check those logins on the new server. Contained database users store passwords inside the database and do not need master logins. Still, an admin must enable contained databases on the server and database first.
Keeping access safe during database recovery
During an outage, teams often grant broad permissions to fix problems fast. Avoid adding regular engineers to the fixed owner role during a recovery event. Members of that owner role can perform all maintenance and even drop the database. Note that you cannot change the permissions assigned to fixed database roles.
Instead, give responders read-only roles when they only need to check data after recovery. The fixed data reader role lets members read all data from user tables and views. Only grant write or admin rights to the specific person running the recovery task. If a database holds personal details, mask phone numbers, emails, and card numbers in query results. Masking rewrites matched fields in results so responders can check tables safely.
Govern SQL Server queries and responses in flight
Table grants decide which SQL Server objects a caller may touch. They do not check query intent or rewrite sensitive values in results across every client and agent. By design, hoop.dev sits inline in the TDS wire protocol next to SQL Server as a sidecar for your SQL Server. On every production batch from an engineer or AI agent, hoop.dev decides to pass, mask, block, or hold it for approval.
With hoop.dev guardrails and hoop.dev data masking, banned statements are refused or held for review, matched sensitive fields in supported result columns are masked in memory, and each decision is logged. Check out the code on GitHub.
Frequently asked questions
What does severity 16 mean for sql server error 1406?
Severity 16 means the error comes from a user request or database state rule. It does not mean the server software or disk hardware has crashed.
Will removing database mirroring delete my stored data?
No, removing mirroring only stops the sync link between the two servers. You then recover the database to bring the existing data online for users.
Why do logins fail after I recover the mirror database?
Standard SQL users tie to a server login stored in the master database. If the secondary server lacks that login in master, the user cannot log in.
Related guides
In this post