Troubleshooting Guide: Error 5519 — Missing Primary FILESTREAM Log Filegroup
Why This Error Happens
This error occurs because SQL Server 2025 requires a database to have a designated primary FILESTREAM filegroup (marked with CONTAINS FILESTREAM) along with an associated log file before any additional, non-primary FILESTREAM filegroups can be added. When administrators attempt to create secondary FILESTREAM filegroups without first establishing this primary structure, the database engine rejects the operation because there is no valid storage container to reference metadata and transaction logging for the FILESTREAM data. Essentially, the database schema is attempting to build a secondary structure on a foundation that does not yet exist.
Step-by-Step Resolution Guide
Step 1: Verify FILESTREAM is Enabled at the Instance Level
- Open SQL Server Configuration Manager on Windows Server 2025 / Windows 11.
- Navigate to SQL Server Services > right-click your instance > Properties > FILESTREAM tab.
- Ensure “Enable FILESTREAM for Transact-SQL access” is checked.
- Confirm via T-SQL:
EXEC sp_configure 'filestream access level';
- If the value is
0, run:
EXEC sp_configure 'filestream access level', 2;
RECONFIGURE;
Step 2: Create the Primary FILESTREAM Filegroup
- Alter the target database to add a primary FILESTREAM filegroup before adding any others.
- Run the following T-SQL, replacing
YourDatabasewith your actual database name:
ALTER DATABASE YourDatabase
ADD FILEGROUP FileStreamGroup1 CONTAINS FILESTREAM;
- This filegroup must be marked as the primary FILESTREAM group—only one filegroup can hold this designation per database.
Step 3: Add the Required Log File to the Primary Filegroup
- Associate a physical file/folder path with the primary FILESTREAM filegroup you just created.
- Use a dedicated, empty directory (SQL Server creates the folder structure itself):
ALTER DATABASE YourDatabase
ADD FILE
(
NAME = FileStreamDoc1,
FILENAME = 'C:\SQLData\FileStreamData\FileStreamGroup1'
)
TO FILEGROUP FileStreamGroup1;
- Ensure the SQL Server service account has read/write permissions on the
C:\SQLData\FileStreamData\path.
Step 4: Add Secondary FILESTREAM Filegroups
- Once the primary filegroup and file exist, you can now safely add additional FILESTREAM filegroups:
ALTER DATABASE YourDatabase
ADD FILEGROUP FileStreamGroup2 CONTAINS FILESTREAM;
ALTER DATABASE YourDatabase
ADD FILE
(
NAME = FileStreamDoc2,
FILENAME = 'C:\SQLData\FileStreamData\FileStreamGroup2'
)
TO FILEGROUP FileStreamGroup2;
- Confirm no path or filegroup naming conflicts exist before executing.
Alternative or Verification Steps
- Verify successful configuration by querying
sys.filegroupsandsys.database_files:
SELECT name, type_desc, is_default FROM sys.filegroups WHERE type = 'FD';
- If the error persists, drop any partially created FILESTREAM filegroups via
ALTER DATABASE ... REMOVE FILEGROUP, restart the SQL Server service, and repeat Steps 2–3 in strict order before attempting Step 4 again.