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;andSELECT 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:5022vs.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_endpointsare 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
nslookuporResolve-DnsNamein 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 MSSQLSERVERin PowerShell (elevated) if endpoint changes were made. - Re-run the
ALTER DATABASE SET PARTNERcommand 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 showSYNCHRONIZEDorSYNCHRONIZINGrather than remainingNULLorDISCONNECTED. - 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.