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

Troubleshooting Guide: SQL Server Error 941

Why This Error Happens

Error 941 occurs when SQL Server has registered a database in its metadata but has not completed the recovery process required to bring it online, often because the database is stuck in a transitional state (e.g., RESTORING, RECOVERY_PENDING, or SUSPECT). This typically happens after an unexpected shutdown, a failed or interrupted restore operation, or corruption in the primary data file (.mdf) that prevents the Storage Engine from finishing crash recovery. It can also occur if the SQL Server service account lacks the necessary file system permissions to access the database files during startup.

Step-by-Step Resolution Guide

Step 1: Check the Current Database State

  • Open SQL Server Management Studio (SSMS) or connect via sqlcmd.
  • Run the following query to check the state description:
  SELECT name, state_desc, recovery_model_desc 
  FROM sys.databases 
  WHERE name = 'YourDatabaseName';
  • Look specifically for states like RECOVERY_PENDING, SUSPECT, or OFFLINE.

Step 2: Review the SQL Server Error Log

  • Navigate to the default log path: C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG.
  • Search for entries corresponding to the specific database ID mentioned in the Error 941 message.
  • Look for underlying I/O errors (such as Error 823 or 824) that indicate physical corruption on the disk, or permission-denied messages regarding the .mdf/.ldf files.

Step 3: Verify File System Permissions

  • Right-click the folder containing your database files (default: C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\DATA) and select Properties > Security.
  • Ensure the SQL Server service account (e.g., NT Service\MSSQLSERVER) has Full Control over this directory.
  • If permissions were recently changed (e.g., due to a Windows Server 2025 security policy update), reset them to the default inherited permissions and restart the SQL Server service via services.msc.

Step 4: Force Recovery or Restore the Database

  • If the database remains in RECOVERY_PENDING due to a missing transaction log, attempt to bring it online using emergency mode:
  ALTER DATABASE YourDatabaseName SET EMERGENCY;
  DBCC CHECKDB('YourDatabaseName');
  ALTER DATABASE YourDatabaseName SET ONLINE;
  • If the database is marked SUSPECT due to corruption, restore the most recent clean backup using the Restore Database wizard in SSMS.

Alternative or Verification Steps

  • Verify the Fix: Re-run the SELECT name, state_desc FROM sys.databases query to confirm the state_desc column now reads ONLINE.
  • Alternative Solution: If EMERGENCY mode fails to resolve the corruption, detach the database (sp_detach_db) and attempt to re-attach the .mdf file manually using CREATE DATABASE ... FOR ATTACH_REBUILD_LOG to regenerate a corrupted transaction log file.