Troubleshooting Guide: Error 5510 – “LOG ON cannot be used for non-FILESTREAM file group”
Why This Error Happens
This error occurs when a CREATE DATABASE or ALTER DATABASE statement includes a LOG ON clause referencing a file group that was not explicitly declared as CONTAINS FILESTREAM. SQL Server 2025 strictly validates that the LOG ON syntax is only paired with FILESTREAM-enabled file groups, since standard transaction log files use a separate LOG ON definition outside of file group syntax. This typically results from a scripting error, a migrated T-SQL script from an older template, or confusion between regular row-data file groups and FILESTREAM file groups.
Step-by-Step Resolution Guide
Step 1: Review the Database Creation Script
- Open the T-SQL script that generated the error and locate the
CREATE DATABASEorALTER DATABASEstatement. - Identify which file group is being referenced in the
LOG ONclause. - Check whether that file group was declared with
CONTAINS FILESTREAMor as a standardPRIMARY/secondary file group.
Step 2: Correct the File Group Declaration
- If the file group is intended to store FILESTREAM data, add the
CONTAINS FILESTREAMkeyword explicitly:
FILEGROUP [FileStreamGroup1] CONTAINS FILESTREAM
- If the file group is meant for regular transaction log storage, remove it entirely from the
LOG ONclause and instead define it using the standard log file syntax:
LOG ON
( NAME = N'MyDB_log', FILENAME = N'C:\SQLData\MyDB_log.ldf' )
Step 3: Separate FILESTREAM and Log Definitions
- Ensure FILESTREAM groups are only referenced under
FILEGROUP ... CONTAINS FILESTREAM, never insideLOG ON. - Ensure transaction log files are defined strictly under
LOG ON, with no file group association. - Example corrected structure:
CREATE DATABASE MyDB
ON PRIMARY
( NAME = N'MyDB', FILENAME = N'C:\SQLData\MyDB.mdf' ),
FILEGROUP FileStreamGroup1 CONTAINS FILESTREAM
( NAME = N'FSGroup1', FILENAME = N'C:\SQLData\FSFolder' )
LOG ON
( NAME = N'MyDB_log', FILENAME = N'C:\SQLData\MyDB_log.ldf' );
Step 4: Re-run and Validate the Script
- Execute the corrected script in SQL Server Management Studio (SSMS) or Azure Data Studio.
- Confirm the database is created without triggering Error 5510.
- Check the SQL Server Error Log (
Management > SQL Server Logsin SSMS) to confirm no related warnings appear.
Alternative or Verification Steps
- Run
sp_helpfilegroupor querysys.filegroupsandsys.database_filesto confirm the FILESTREAM file group is correctly flagged (type = 'FD') and that log files are associated withtype = 'L'. - If the issue persists, drop and recreate the database using the Database Properties GUI in SSMS, manually assigning file groups and log files through the Files page to avoid scripting syntax errors.