Troubleshooting Guide: SQL Server Error 3034 – “No Files Were Selected to be Processed”
Why This Error Happens
Error 3034 typically occurs during a BACKUP or RESTORE operation when SQL Server cannot locate any valid files associated with the specified filegroup(s). This usually happens because a referenced filegroup has no members (data files), the filegroup is marked read-only or offline, or the backup command syntax incorrectly references a filegroup name that doesn’t contain active files. In some cases, this is also triggered by corrupted system metadata in sys.filegroups or sys.database_files following an incomplete file migration.
Step-by-Step Resolution Guide
Step 1: Verify Filegroup Membership
- Open SQL Server Management Studio (SSMS) and connect to the instance running on Windows Server 2025.
- Run the following query to check for empty filegroups:
SELECT fg.name AS FilegroupName, df.name AS FileName, df.physical_name
FROM sys.filegroups fg
LEFT JOIN sys.database_files df ON fg.data_space_id = df.data_space_id
WHERE df.file_id IS NULL;
- Identify any filegroup returned with a
NULLfile association.
Step 2: Add a Data File to the Empty Filegroup
- If a filegroup is confirmed empty, add a physical file to it using:
ALTER DATABASE [YourDatabase]
ADD FILE (NAME = N'YourFile_Data', FILENAME = N'C:\SQLData\YourFile_Data.ndf', SIZE = 10MB)
TO FILEGROUP [YourFilegroupName];
- Ensure the path
C:\SQLData\exists and the SQL Server service account has write permissions to this directory.
Step 3: Correct the Backup/Restore Command Syntax
- Review the T-SQL script or maintenance plan step that triggered the error.
- Ensure the
FILEGROUP = 'Name'clause matches an existing, populated filegroup exactly (case-sensitive if using case-sensitive collation). - Remove any reference to legacy or renamed filegroups that no longer hold active files.
Step 4: Check for Offline or Restricted Filegroups
- Run
sp_helpfileandsp_helpfilegroupto check the status of all files and filegroups. - If a filegroup is marked
OFFLINE, bring it back online via:
ALTER DATABASE [YourDatabase] MODIFY FILEGROUP [YourFilegroupName] ONLINE;
Alternative or Verification Steps
- Re-run the original
BACKUP DATABASEorRESTOREcommand and confirm that Error 3034 no longer appears in the SQL Server Error Log (Event Viewer > Applications and Services Logs > MSSQLSERVER). - If the issue persists, use the Database Properties > Files page in SSMS to manually inspect filegroup-to-file mapping, or restore the database to a new location using
WITH MOVEto bypass corrupted filegroup metadata entirely.