SQL Server error 955 means the database you are trying to use is enabled for database mirroring but the mirroring session is not active or the database is not in the correct state for the operation you attempted. The fix is to either complete the mirroring setup, remove mirroring if it is no longer needed, or bring the database into the required state (for example, restore it WITH NORECOVERY on the mirror server). This guide walks you through the safe, supported steps to clear the error.
What You'll Need
- SQL Server Management Studio (SSMS) or sqlcmd access to the principal and mirror instances.
- sysadmin or db_owner permissions on the affected database.
- The database name and, if mirroring is configured, the mirror server name and endpoint details.
- A recent backup if you plan to remove mirroring or reconfigure it (always verify the backup first).
Step-by-Step
- Identify the database state. Connect to the instance in SSMS, open a new query window, and run:
SELECT name, state_desc, mirroring_state_desc FROM sys.databases WHERE name = 'YourDB';
Checkstate_desc(should be ONLINE) andmirroring_state_desc(for example, SYNCHRONIZED, SUSPENDED, DISCONNECTED, or NULL if mirroring is not active). This tells you whether mirroring is configured but broken, or configured and never completed. - Decide whether you still need mirroring. Database mirroring is deprecated in modern SQL Server versions. If you do not need it, removing it is the cleanest fix. If you do need it, skip to step 5.
- Remove mirroring (if not needed). On the principal, run:
ALTER DATABASE YourDB SET PARTNER OFF;
Then confirm:SELECT mirroring_state_desc FROM sys.databases WHERE name = 'YourDB';
It should return NULL. If the command fails because the partner is unreachable, you may need to remove the mirroring endpoint or useALTER DATABASE ... SET PARTNER OFFwith the mirror server stopped. Always take a fresh backup before changing mirroring settings. - If you want to keep mirroring, complete the setup. On the mirror server, restore the principal's full backup and at least one log backup WITH NORECOVERY:
RESTORE DATABASE YourDB FROM DISK = 'C:\backup\YourDB.bak' WITH NORECOVERY;RESTORE LOG YourDB FROM DISK = 'C:\backup\YourDB.trn' WITH NORECOVERY;
Then create the mirroring endpoint on both servers if not already present:CREATE ENDPOINT Mirroring STATE = STARTED AS TCP (LISTENER_PORT = 5022) FOR DATABASE_MIRRORING (ROLE = PARTNER);
(Use ROLE = WITNESS on a witness server if applicable.) - Start the mirroring session. On the mirror, set the principal partner:
ALTER DATABASE YourDB SET PARTNER = 'TCP://PrincipalServer:5022';
On the principal, set the mirror partner:ALTER DATABASE YourDB SET PARTNER = 'TCP://MirrorServer:5022';
Checkmirroring_state_descagain; it should move to SYNCHRONIZED or SYNCHRONIZING. - Verify the database is usable. Run a simple query against the database. If error 955 persists, check that no other session is holding the database in a transitional state (for example, a restore in progress). Use
sys.dm_exec_requestsandsys.dm_tran_locksto look for blocking. - If mirroring is suspended, resume it. On the principal, run
ALTER DATABASE YourDB SET PARTNER RESUME;and confirm the state returns to SYNCHRONIZED.
Common Mistakes
- Running
ALTER DATABASE ... SET PARTNER OFFwithout a current backup; always back up first. - Restoring the mirror database WITH RECOVERY instead of WITH NORECOVERY; the mirror must stay in restoring state until the session starts.
- Using the wrong endpoint port or server name in the PARTNER string; the TCP URL must match the endpoint listener exactly.
- Forgetting that the mirror database must be restored from a full backup plus at least one log backup taken after the full backup.
- Assuming error 955 always means mirroring is broken; sometimes it means the database is in a transitional state (for example, a restore is still running) and you simply need to wait or check
state_desc.
Tips
- Use
sys.database_mirroringto see detailed mirroring status, includingmirroring_state_descandmirroring_role_desc. - If you are on SQL Server 2012 or later, consider Always On Availability Groups instead of database mirroring, since mirroring is deprecated.
- Keep the principal and mirror on the same SQL Server version and edition that supports mirroring (Standard or Enterprise, depending on version).
- Test failover in a non-production environment before relying on mirroring for high availability.
Troubleshooting
If ALTER DATABASE ... SET PARTNER OFF fails because the mirror is unreachable, stop the mirroring endpoint on the mirror server or take the mirror server offline, then retry. If the database is stuck in RESTORING, you may need to restore it WITH RECOVERY (which discards mirroring) or complete the mirroring setup. If you see error 1418 (server network address cannot be reached), check firewall rules for the mirroring port and ensure the SQL Server service account has permission to connect. If the mirroring state is SUSPENDED, resume it with SET PARTNER RESUME; if it is DISCONNECTED, check network connectivity and the endpoint state. For persistent issues, review the SQL Server error log on both instances for mirroring-related messages.
Frequently Asked Questions
What does error 955 actually mean?
It means the database is enabled for mirroring but the mirroring session is not in a state that allows the requested operation, often because the mirror is not fully configured or is suspended.
Can I just ignore error 955?
No, it usually blocks the operation you are trying to perform. You need to either complete or remove mirroring.
Is database mirroring still supported?
It is deprecated in SQL Server 2012 and later, but still available in some editions. Microsoft recommends Always On Availability Groups for new deployments.
How do I know if mirroring is configured on a database?
Query sys.databases and check mirroring_state_desc; if it is not NULL, mirroring is configured.
What permissions do I need to fix error 955?
You need sysadmin or db_owner on the database, and CONTROL SERVER to manage endpoints.
Will removing mirroring affect my data?
No, removing mirroring only stops the mirroring session; the principal database remains intact. Always back up first.