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

Troubleshooting Guide: SQL Server Error 4336

Why This Error Happens

Error 4336 occurs during a piecemeal or file/filegroup restore operation when the restore sequence attempts to bring a filegroup online that has been previously dropped from the database. SQL Server retains metadata references to dropped filegroups in the backup history and transaction log chain, but since the physical filegroup no longer exists in the current database schema, it cannot be reconciled with an online restore. This typically happens when restoring a sequence of backups taken both before and after a DROP FILEGROUP operation was executed, or when attempting a partial restore against a database where the filegroup structure has changed since the backup was created.

Step-by-Step Resolution Guide

Step 1: Identify the Dropped Filegroup and Backup Timeline

  • Query msdb.dbo.backupfilegroup to determine when the filegroup was active and in which backup sets it appears.
  • Run the following to cross-reference backup history:
  SELECT bs.backup_start_date, bfg.filegroup_name 
  FROM msdb.dbo.backupset bs
  JOIN msdb.dbo.backupfilegroup bfg ON bs.backup_set_id = bfg.backup_set_id
  WHERE bs.database_name = 'YourDatabaseName';
  • Confirm whether the DROP FILEGROUP statement was executed before or after your target restore point.

Step 2: Restore the Full Database Offline Instead of Piecemeal

  • Avoid using WITH PARTIAL or RESTORE DATABASE ... FILEGROUP syntax if the filegroup was dropped at any point in the chain.
  • Perform a complete, non-piecemeal restore using:
  RESTORE DATABASE YourDatabaseName 
  FROM DISK = 'C:\SQLBackups\YourDatabase_Full.bak' 
  WITH NORECOVERY;
  • Continue restoring subsequent differential and transaction log backups in strict chronological order, ensuring you do not skip the backup taken immediately after the filegroup was dropped.

Step 3: Exclude the Dropped Filegroup from the Restore Plan

  • If performing a piecemeal restore, explicitly exclude the dropped filegroup using the READ_WRITE_FILEGROUPS clause rather than naming the obsolete filegroup directly.
  • Use SQL Server Management Studio (SSMS) 21 on Windows 11/Server 2025 to review the Files page under Database Properties to confirm the current active filegroup list before scripting the restore.
  • Re-run the restore sequence targeting only filegroups that exist in the final database state.

Step 4: Validate Backup Media Integrity

  • Run RESTORE VERIFYONLY FROM DISK = 'C:\SQLBackups\YourDatabase_Full.bak' to rule out corruption as a contributing factor.
  • Check the SQL Server error log located at C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG for corroborating I/O or backup chain warnings.

Alternative or Verification Steps

  • After restore completion, run RESTORE HEADERONLY and sp_helpfile against the recovered database to confirm all active filegroups are online and the dropped filegroup no longer appears in the file list.
  • If the error persists, consider restoring to a new database name first, then use DBCC CHECKDB and data export/import (via bcp or SSIS) to migrate only the required data, bypassing the problematic filegroup entirely.