SQL Server Error 1470: Fix the Partner Config
In this article
SQL Server error 1470 ("The ALTER DATABASE statement failed. The database ... is enabled for database mirroring, but no partner is configured") appears when you try to change a mirrored database while the mirroring partnership is incomplete or broken. The fix is to either complete the mirroring setup or remove mirroring before running your ALTER DATABASE command. This guide walks you through both paths safely.
What You'll Need
- SQL Server Management Studio (SSMS) or sqlcmd connected to the principal server with sysadmin rights.
- The database name and the names of the principal, mirror, and witness servers (if used).
- A current backup of the database and transaction log before making changes.
- Network connectivity and matching endpoints between the servers if you intend to re-establish mirroring.
Step-by-Step
- Confirm the mirroring state. Run
SELECT DB_NAME(database_id) AS db, mirroring_state_desc, mirroring_role_desc, mirroring_partner_name FROM sys.database_mirroring WHERE mirroring_state IS NOT NULL;on the principal. Ifmirroring_state_descisSYNCHRONIZINGorSYNCHRONIZEDand a partner is listed, your ALTER should work; if it isDISCONNECTEDorPENDING_FAILOVERwith no partner, that is the cause of error 1470. - Decide your goal. If you still want mirroring, go to step 3. If you want to modify the database without mirroring, skip to step 6 to remove it first.
- Re-establish the partnership (if keeping mirroring). On the principal, run
ALTER DATABASE [YourDB] SET PARTNER = 'TCP://MirrorServer:5022';using the mirror's actual endpoint. Then on the mirror, run the same command pointing back to the principal. Wait for the state to become SYNCHRONIZED. - Verify the endpoint and service accounts. Check that both servers have a database mirroring endpoint (
SELECT name, role_desc, state_desc FROM sys.database_mirroring_endpoints;) and that the SQL Server service accounts can authenticate to each other. A firewall blocking port 5022 (or your chosen port) will leave the partner unconfigured and reproduce error 1470. - Retry your original ALTER DATABASE statement. With a healthy partner, statements such as
ALTER DATABASE [YourDB] SET RECOVERY FULL;or adding a file will proceed. If the error persists, re-check step 1. - Remove mirroring (if you no longer need it). On the principal, run
ALTER DATABASE [YourDB] SET PARTNER OFF;. On the mirror, runALTER DATABASE [YourDB] SET PARTNER OFF;as well if it still shows a partnership. This clears the mirroring metadata so ordinary ALTER DATABASE commands work. - Drop the endpoint only if unused. If no other database uses mirroring, you may drop the endpoint with
DROP ENDPOINT [Mirroring];. Do not drop it if other databases rely on it. - Re-run your intended change. After mirroring is off, execute the ALTER DATABASE statement again. It should now succeed without error 1470.
- Reconfigure mirroring if needed later. Back up the principal, restore WITH NORECOVERY on the mirror, restore the log WITH NORECOVERY, then set the partner on both sides as in step 3.
Common Mistakes
- Running
SET PARTNERon only one server. Both principal and mirror must point at each other; a one-sided command leaves the partnership incomplete and the error returns. - Using a hostname that does not resolve from the other server. Use the fully qualified domain name or IP that the partner can actually reach.
- Forgetting that
SET PARTNER OFFmust be run on both sides when the mirror is still reachable. Running it only on the principal can leave the mirror in a restoring state. - Attempting to change recovery model, add files, or rename the database while mirroring is mid-failover. Wait until the state is stable.
- Assuming error 1470 means corruption. It is a configuration state error, not a data error.
Tips
- Always script the current mirroring configuration before changing it: capture
sys.database_mirroringand endpoint definitions so you can rebuild quickly. - Use the same collation and compatibility level on principal and mirror to avoid setup failures.
- If you use a witness for automatic failover, include it in your
SET WITNESScommand on the principal after the partner is set. - Test failover in a non-production window; a failed failover can leave the database in a SUSPECT or RECOVERY_PENDING state.
Troubleshooting
If SET PARTNER returns an error, check the SQL Server error log on both servers for endpoint or login failures. Verify that the mirroring endpoint state is STARTED and that the service accounts have CONNECT permission on the endpoint. If the partner name resolves but the connection times out, test the port with telnet MirrorServer 5022 from the principal. If the mirror database is stuck in RESTORING, re-apply the log backups WITH NORECOVERY. If you cannot remove mirroring because the mirror is offline, run ALTER DATABASE [YourDB] SET PARTNER OFF; on the principal anyway; SQL Server will force the removal and the mirror will need to be rebuilt. After any forced removal, take a fresh full backup before reconfiguring. If error 1470 appears on a database you believe was never mirrored, check for leftover metadata by querying sys.database_mirroring; a database restored from a mirrored backup can retain the flag until SET PARTNER OFF is run.
Frequently Asked Questions
What causes SQL Server error 1470?
The database is flagged as mirroring-enabled but has no active partner, so SQL Server blocks ALTER DATABASE changes that would affect the mirrored configuration.
Can I ignore error 1470?
No. The ALTER statement will not execute until you either complete the mirroring partnership or turn mirroring off.
Does SET PARTNER OFF delete my data?
No. It only removes the mirroring relationship. The principal database remains intact; the mirror becomes a restoring database you can recover or drop.
Do I need to run SET PARTNER OFF on both servers?
Yes, when both are reachable. If the mirror is offline, running it on the principal forces removal.
Will error 1470 affect my applications?
Only the ALTER DATABASE command fails. Normal queries continue to run against the principal unless the mirroring state itself is broken.
How do I know mirroring is fully removed?
Query sys.database_mirroring; mirroring_state should be NULL and mirroring_partner_name empty.