Troubleshooting Guide: SQL Server Error 5193 — Lease Mismatch File Access Failure
Why This Error Happens
Error 5193 occurs when SQL Server 2025 detects a mismatch between the lease token it holds for a database file and the lease token recorded by the underlying storage layer, typically on network-attached storage, Storage Spaces Direct, or cloud-backed volumes. This usually happens when another process or node has taken ownership of the file lease (common in failover cluster or Always On scenarios), or when the lease expired due to a network interruption or storage latency spike. SQL Server treats this as a potential data integrity risk and proactively takes the database offline rather than risk writing to a file it no longer has exclusive, verified control over.
Step-by-Step Resolution Guide
Step 1: Verify Storage Connectivity and Lease Ownership
- Check Windows Server 2025 Event Viewer under Windows Logs > System for disk or network timeout events (Event ID 153 or 157) that may have preceded the SQL error.
- Run
Get-SmbMultichannelConnectionorGet-PhysicalDiskin PowerShell to confirm storage path stability if using SMB3 or Storage Spaces Direct. - Confirm no other SQL Server instance, cluster node, or snapshot/backup tool currently holds an active lease on the same
.mdf/.ldffile path.
Step 2: Restart the Affected Database Safely
- Open SQL Server Management Studio (SSMS) or run via
sqlcmd: ALTER DATABASE [YourDBName] SET OFFLINE WITH ROLLBACK IMMEDIATE;ALTER DATABASE [YourDBName] SET ONLINE;- This forces SQL Server to release and re-acquire a fresh lease token against the storage subsystem.
Step 3: Check Cluster and Always On Availability Group Configuration
- If using Always On AGs or Failover Cluster Instances (FCI), open Failover Cluster Manager and verify only one node is actively hosting the resource group.
- Inspect
%ProgramFiles%\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOGfor concurrent lease acquisition attempts from a secondary node. - Ensure cluster heartbeat network settings (under Networks tab in Failover Cluster Manager) have no latency exceeding the configured
SameSubnetThreshold.
Step 4: Update Storage Drivers and SQL Server Cumulative Update
- Confirm the storage HBA/NIC drivers are current via Device Manager > Properties > Driver tab, especially for SMB Direct (RDMA) adapters.
- Apply the latest SQL Server 2025 Cumulative Update from the Microsoft Update Catalog, as early builds may contain known lease-handling timing bugs.
- Reboot the node after driver and CU installation to clear any stale lease cache held by the OS storage driver.
Alternative or Verification Steps
- After bringing the database back online, run
DBCC CHECKDB('YourDBName') WITH NO_INFOMSGS, ALL_ERRORMSGS;to confirm no corruption occurred during the lease failure window. - If the issue recurs intermittently, move the database files to local SSD storage temporarily to isolate whether the root cause is network/storage-layer latency versus a SQL Server configuration problem.