SQL SERVER – How to Break Mirroring?

SET PARTNER OFF can break mirroring by permanently removing its relationship. I confirm the intended outcome before either command.

A detached cabinet coupling remains separate from the key for reopening the protected second cabinet.

SELECT DB_NAME(database_id) AS DatabaseName,mirroring_state_desc,
       mirroring_role_desc,mirroring_partner_name FROM sys.database_mirroring
WHERE mirroring_guid IS NOT NULL;
-- Planned removal on the verified principal or mirror:
-- ALTER DATABASE [YourDatabase] SET PARTNER OFF;
-- On the former mirror only, when recovery is deliberately intended:
-- RESTORE DATABASE [YourDatabase] WITH RECOVERY;

Confirm database identity, roles and synchronization state first. Each instance retains a separate copy. The former mirror normally remains RESTORING.

WITH RECOVERY can make that copy available when approved. It starts a new recovery fork and ends its restore sequence. It is not a universal second command for either server. Additional restores or rebuilding mirroring need a new plan.

Preserve recoverable backups and coordinate application routing. Avoid independently writable copies competing as the authority. Mirroring is deprecated, so assess a supported design for new deployments. The commands remain disabled administrative templates.

Reference: Mirroring removal and recovery consequences.

Related reading

Removing mirroring is not pausing synchronization, it is a permanent relationship change that needs a recovery plan.

Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.


Discover more from SQL Authority with Pinal Dave

Subscribe to get the latest posts sent to your email.

SQL Mirroring, SQL Scripts, SQL Server
Previous Post
Prevent Index Changes in SQL Server With a DDL Trigger
Next Post
SQL SERVER – Types of Triggers

Related Posts

1 Comment. Leave new

  • Good one. May be can add Failover and Suspend too.

    ALTER DATABASE [DatabaseName] SET PARTNER FAILOVER;

    ALTER DATABASE [DatabaseName] SET PARTNER SUSPEND;

    Have a question. Whenever failover to happens, Identity value is reset to next whole number. If you take a case that identity value was 245 or 455 then it changes to 1000.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.