How to fix Error 1452 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 1452 – Partner Server Instance Name Conflict in SQL Server 2025

Why This Error Happens

This error occurs when the ALTER DATABASE SET PARTNER command attempts to configure database mirroring, but the partner server instance name specified is identical to the principal server instance managing the database. SQL Server requires distinct, uniquely addressable instance names (including network name, port, and instance identifier) for the principal, mirror, and optional witness servers to prevent self-referencing mirroring loops. This commonly happens due to copy-pasted connection strings, incorrect alias configuration in SQL Server Configuration Manager, or DNS/CNAME records that inadvertently resolve both endpoints to the same instance.

Step-by-Step Resolution Guide

Step 1: Verify the Actual Instance Names and Endpoints

  • Open SQL Server Management Studio (SSMS) on both the principal and mirror servers.
  • Run SELECT @@SERVERNAME; and SELECT local_net_address, local_tcp_port FROM sys.dm_exec_connections WHERE session_id = @@SPID; on each server.
  • Confirm the two servers return different network names, IP addresses, or TCP ports (e.g., SQLPROD01:5022 vs. SQLMIRROR01:5023).

Step 2: Correct the ALTER DATABASE Syntax

  • Reissue the command using fully qualified, distinct endpoint addresses:
  ALTER DATABASE [YourDB] SET PARTNER = 'TCP://SQLMIRROR01.domain.com:5023';
  • Ensure you are NOT running this command against the same instance twice (common copy-paste error when scripting both principal and mirror setup).
  • Double-check the mirroring endpoint port numbers configured via sys.database_mirroring_endpoints are unique per instance.

Step 3: Validate Network Aliases and DNS Resolution

  • On Windows Server 2025, open SQL Server Configuration Manager > SQL Native Client Configuration > Aliases.
  • Confirm no alias incorrectly points both the principal and mirror names to the same IP/port combination.
  • Use nslookup or Resolve-DnsName in PowerShell to verify the mirror server’s hostname resolves to a separate IP address than the principal.

Step 4: Restart Mirroring Endpoints and Re-run Configuration

  • On both instances, restart the mirroring endpoint:
  ALTER ENDPOINT [Mirroring] STATE = STARTED;
  • Restart the SQL Server service via Services.msc or Restart-Service MSSQLSERVER in PowerShell (elevated) if endpoint changes were made.
  • Re-run the ALTER DATABASE SET PARTNER command with the corrected, distinct partner address.

Alternative or Verification Steps

  • Verify success by querying SELECT mirroring_state_desc FROM sys.database_mirroring WHERE database_id = DB_ID('YourDB'); — it should show SYNCHRONIZED or SYNCHRONIZING rather than remaining NULL or DISCONNECTED.
  • If the issue persists, drop and recreate the mirroring endpoints entirely using unique port numbers (e.g., 5022 for principal, 5023 for mirror) and reconfigure mirroring from scratch using the New Database Mirroring Wizard in SSMS.