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

Why This Error Happens

This error occurs because SQL Server 2025 detects that a database file is currently in an “offline-restoring” state as part of a page-level restore sequence. The SIMPLE recovery model does not support the log-chain continuity required to complete a RESTORE PAGE operation, so the engine blocks the switch to prevent data corruption. Essentially, the database believes a restore sequence is incomplete, even if you intended to abandon it.

Step-by-Step Resolution Guide

Step 1: Verify the Current Restore State

  • Open SQL Server Management Studio (SSMS) or connect via sqlcmd on your Windows Server 2025 instance.
  • Run the following query to check file states: SELECT name, state_desc FROM sys.master_files WHERE database_id = DB_ID('YourDBName');
  • Look specifically for a state_desc of RESTORING on any file; this confirms the page restore is still pending completion.

Step 2: Complete or Cancel the Pending Restore Sequence

  • If you intend to finish the restore, run RESTORE DATABASE YourDBName WITH RECOVERY; to close out the sequence.
  • If the restore was accidental or is no longer needed, you must restore the specific file from a full backup again and immediately recover it, rather than trying to force a model change: RESTORE DATABASE YourDBName FILE = 'YourFile_Name' FROM DISK = 'C:\Backups\FullBackup.bak' WITH RECOVERY;
  • Avoid using WITH NORECOVERY again until you are ready to finalize the chain.

Step 3: Change the Recovery Model (Post-Verification)

  • Once the file state no longer shows RESTORING, navigate to Object Explorer in SSMS.
  • Right-click the Database > Properties > Options.
  • Change the “Recovery Model” dropdown to Simple and click OK, or execute: ALTER DATABASE YourDBName SET RECOVERY SIMPLE;

Step 4: Restart SQL Server Services (If State Persists)

  • If the sys.master_files view still incorrectly flags the file as restoring due to a cached metadata lock, restart the service.
  • Open Services.msc on Windows Server 2025.
  • Locate SQL Server (MSSQLSERVER), right-click, and select Restart to clear any stuck session locks associated with the failed restore handle.

Alternative or Verification Steps

  • Verification: After running the ALTER DATABASE command, re-query sys.databases using SELECT recovery_model_desc FROM sys.databases WHERE name = 'YourDBName'; to confirm the output reads SIMPLE.
  • Alternative: If the file remains stuck in a RESTORING state with no valid backup media available to complete the chain, you may need to take the specific file offline using ALTER DATABASE YourDBName MODIFY FILE (NAME = YourFile_Name, OFFLINE) before attempting the recovery model change.