Troubleshooting Guide: SQL Server Error 5191 – Local Directory Used for TempDB in a Clustered Server
Why This Error Happens
This error occurs when SQL Server 2025 is configured as a clustered instance (Failover Cluster Instance) and the tempdb data or log files are pointed to a local, non-shared directory path that does not exist identically on every node in the Windows Server 2025 cluster. Because failover clustering requires that any node be able to host the SQL Server resource at any time, a path that only exists on one node (or lacks proper permissions) causes validation to fail. This typically stems from manually editing file paths during setup, restoring a configuration from a standalone instance, or forgetting to pre-create the local folder structure on all passive nodes.
Step-by-Step Resolution Guide
Step 1: Verify TempDB Path Consistency Across All Nodes
- Open File Explorer or PowerShell on every node participating in the Windows Server Failover Cluster (WSFC).
- Confirm the exact folder path referenced in the error message (e.g.,
D:\SQLData\TempDB) exists identically on each node. - Run
Test-Path "D:\SQLData\TempDB"in PowerShell on each node to confirmTrueis returned.
Step 2: Create the Missing Directory on All Cluster Nodes
- If the path does not exist on one or more nodes, manually create it using
New-Item -ItemType Directory -Path "D:\SQLData\TempDB" -Force. - Ensure the drive letter and folder structure match exactly across nodes (local disks only, not cluster shared storage, since tempdb is intentionally placed on local storage in clustered setups).
Step 3: Assign Correct SQL Server Service Permissions
- Open
Computer Management > Local Users and Groupsor useicaclsto grant the SQL Server service account full control. - Run:
icacls "D:\SQLData\TempDB" /grant "NT SERVICE\MSSQLSERVER:(OI)(CI)F"(replace with the correct service account or named instance service). - Repeat this permission grant on every node, since local security permissions do not replicate across the cluster automatically.
Step 4: Update TempDB Configuration via SQL Server Configuration Manager
- Open SQL Server Configuration Manager and navigate to the instance’s Startup Parameters, or use
ALTER DATABASE tempdb MODIFY FILEin SQL Server Management Studio. - Set the correct local path that now exists on all nodes:
ALTER DATABASE tempdb MODIFY FILE (NAME = tempdev, FILENAME = 'D:\SQLData\TempDB\tempdb.mdf');- Restart the SQL Server service or fail the resource over to apply changes.
Step 5: Validate Cluster Role Failover
- Use Failover Cluster Manager to manually move the SQL Server role to each node.
- Confirm the SQL Server service starts successfully on every node without re-triggering Error 5191.
Alternative or Verification Steps
- Check the SQL Server Error Log and Windows Event Viewer (Application log) after failover to confirm no further Event ID 5191 entries appear.
- As an alternative, use a SQL Server startup trace flag or the
-Tparameter temporarily to redirect tempdb to a guaranteed-valid local path (e.g.,C:\TEMP) on all nodes while permissions and directory structures are being corrected.