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

Troubleshooting Guide: SQL Server Error 1451 – Database Mirroring Information Not Found

Why This Error Happens

Error 1451 occurs when SQL Server attempts to reference mirroring metadata in the sys.database_mirroring system table, but the corresponding entry is missing or has become desynchronized. This typically happens after an incomplete mirroring setup, a failed failover, or when the mirroring endpoint was manually dropped without properly removing the database from the mirroring session. It can also surface after an in-place upgrade to SQL Server 2025 on Windows Server 2025/Windows 11 where legacy mirroring catalog entries were not migrated correctly.

Step-by-Step Resolution Guide

Step 1: Verify the Current Mirroring State

  • Open SQL Server Management Studio (SSMS) and connect to the instance reporting the error.
  • Run the following query to inspect the current state:
SELECT database_id, mirroring_state_desc, mirroring_role_desc, mirroring_partner_name
FROM sys.database_mirroring
WHERE mirroring_guid IS NOT NULL;
  • If the target database does not appear in the result set, this confirms the metadata is missing or orphaned.

Step 2: Remove Residual Mirroring Configuration

  • Execute the following command to forcibly strip any partial mirroring state from the database:
ALTER DATABASE [YourDatabaseName] SET PARTNER OFF;
  • If this returns an error due to missing metadata, instead directly drop the endpoint using:
DROP ENDPOINT [Mirroring_Endpoint];
  • Restart the SQL Server service via services.msc or PowerShell:
Restart-Service -Name 'MSSQLSERVER' -Force

Step 3: Rebuild the Mirroring Endpoint and Catalog Entry

  • Recreate the mirroring endpoint with correct port and encryption settings:
CREATE ENDPOINT Mirroring_Endpoint
STATE = STARTED
AS TCP (LISTENER_PORT = 5022)
FOR DATABASE_MIRRORING (ROLE = PARTNER, ENCRYPTION = REQUIRED ALGORITHM AES);
  • Confirm the Windows Firewall (Windows Server 2025/Windows 11) allows inbound traffic on port 5022:
New-NetFirewallRule -DisplayName "SQL Mirroring" -Direction Inbound -Protocol TCP -LocalPort 5022 -Action Allow
  • Re-establish mirroring from the primary server using ALTER DATABASE ... SET PARTNER = 'TCP://PartnerServer:5022'.

Step 4: Check for Corrupted System Catalog Files

  • If the error persists, run DBCC CHECKDB against the master database to rule out catalog corruption:
DBCC CHECKDB('master') WITH NO_INFOMSGS;
  • If corruption is found, restore master from a verified backup, as mirroring metadata resides partially within system catalogs.

Alternative or Verification Steps

  • Confirm the fix by querying sys.database_mirroring_witnesses and sys.database_mirroring again — the target database should now show mirroring_state_desc = SYNCHRONIZED.
  • If mirroring cannot be restored, consider migrating to Always On Availability Groups, which is the recommended replacement architecture in SQL Server 2025 and avoids legacy mirroring catalog issues entirely.