Symptoms
- Application errors such as:
Could not allocate space for object 'dbo.Orders'.'PK_Orders' in database 'Sales' because the 'PRIMARY' filegroup is full.(Msg 1105). - Related errors in the same incident: Msg 1101 (
Could not allocate a new page ... because of insufficient disk space in filegroup) and autogrow failures in the error log. - Reads still work. Inserts, updates that grow rows, index rebuilds and
SELECT ... INTOfail. - This is not error 9002 (transaction log full) or a tempdb problem. Those have their own runbooks.
1. Confirm scope and impact
Find which database and filegroup, and how often it is failing:
EXEC xp_readerrorlog 0, 1, N'1105';
EXEC xp_readerrorlog 0, 1, N'autogrow';
Check every data file in the affected database: used space, size, max size and growth setting.
USE Sales;
SELECT f.name AS logical_name, fg.name AS filegroup, f.physical_name,
f.size / 128 AS size_mb,
FILEPROPERTY(f.name, 'SpaceUsed') / 128 AS used_mb,
CASE f.max_size WHEN -1 THEN 'unlimited' WHEN 0 THEN 'no growth'
ELSE CAST(f.max_size / 128 AS varchar(20)) END AS max_mb,
CASE f.is_percent_growth WHEN 1 THEN CAST(f.growth AS varchar(10)) + '%'
ELSE CAST(f.growth / 128 AS varchar(10)) + ' MB' END AS growth
FROM sys.database_files f
LEFT JOIN sys.filegroups fg ON f.data_space_id = fg.data_space_id
WHERE f.type_desc = 'ROWS';
Check free space on the volumes holding those files:
SELECT DISTINCT vs.volume_mount_point,
vs.total_bytes / 1048576 AS total_mb,
vs.available_bytes / 1048576 AS free_mb
FROM sys.master_files mf
CROSS APPLY sys.dm_os_volume_stats(mf.database_id, mf.file_id) vs
WHERE mf.database_id = DB_ID('Sales');
2. Identify the cause
| What you see | Cause | Fastest fix |
|---|---|---|
used_mb = size_mb, max_mb reached, disk has free space | MAXSIZE cap on the file | Raise MAXSIZE (step 3a) |
max_mb = no growth (growth = 0) | Autogrowth disabled | Grow the file manually (step 3a) |
Volume free_mb near zero | Disk full | Add a file on another volume or extend the disk (step 3b) |
| Database is about 10 GB and edition is Express | Express edition size limit | Move data out or upgrade the edition |
| Autogrow events time out in the error log | Percent growth on a huge file without instant file initialization | Grow manually in fixed steps (step 3a) |
Check the edition and instant file initialization (IFI) status:
SELECT SERVERPROPERTY('Edition') AS edition;
SELECT servicename, instant_file_initialization_enabled FROM sys.dm_server_services;
3. Restore write capacity
3a. The disk has room: raise the cap or grow the file
ALTER DATABASE Sales MODIFY FILE (NAME = N'Sales_Data', MAXSIZE = UNLIMITED);
ALTER DATABASE Sales MODIFY FILE (NAME = N'Sales_Data', FILEGROWTH = 1024MB);
-- Pre-grow now so you are not waiting on autogrow during peak:
ALTER DATABASE Sales MODIFY FILE (NAME = N'Sales_Data', SIZE = 300GB);
SIZE must be larger than the current size. With IFI enabled, data file growth is close to instant. Without IFI, SQL Server writes zeros to the new space, and a large grow can take minutes and block allocations. In that case, grow in steps of 10–50 GB.
3b. The volume is full: add a file somewhere else
The fastest fix that needs no outage is a new file in the same filegroup on a volume that has space:
ALTER DATABASE Sales
ADD FILE (NAME = N'Sales_Data2', FILENAME = N'E:\SQLData\Sales_Data2.ndf',
SIZE = 50GB, FILEGROWTH = 1024MB)
TO FILEGROUP [PRIMARY];
New allocations go to whichever file has free space (proportional fill), so writes resume straight away. On Linux, use a path such as /var/opt/mssql/data2/Sales_Data2.ndf that the mssql user owns.
On Azure or AWS, you can also extend the managed disk or EBS volume online, then extend the partition in Windows (Disk Management or Resize-Partition) or the filesystem on Linux (growpart plus xfs_growfs or resize2fs).
# After extending the cloud disk, extend the Windows partition to the new maximum
$max = (Get-PartitionSupportedSize -DriveLetter D).SizeMax
Resize-Partition -DriveLetter D -Size $max
Caution
Do not free space by deleting
.mdf,.ndfor.ldffiles or old backups you are unsure of, and do not shrink a data file during the incident. Shrinking is slow, fragments indexes and can fail if writes continue. If you plan to purge data, delete it in small batches. One largeDELETEcan fill the transaction log and turn this into a 9002 outage.
4. Find what grew
The largest tables in the affected filegroup:
SELECT TOP (15) s.name + '.' + t.name AS table_name,
SUM(ps.reserved_page_count) / 128 AS reserved_mb,
SUM(CASE WHEN ps.index_id IN (0,1) THEN ps.row_count END) AS row_count
FROM sys.dm_db_partition_stats ps
JOIN sys.tables t ON ps.object_id = t.object_id
JOIN sys.schemas s ON t.schema_id = s.schema_id
GROUP BY s.name, t.name
ORDER BY reserved_mb DESC;
Compare the result with the last capacity report or monitoring snapshot. Common causes include a runaway logging or staging table, a job that stopped purging, a large index rebuild that needed room for both the old and new copy, and a migration that loaded a backfill.
The default trace keeps recent autogrow events, so you can see when growth sped up:
DECLARE @path nvarchar(260) = (SELECT path FROM sys.traces WHERE is_default = 1);
SELECT TOP (50) te.name AS event, t.DatabaseName, t.FileName,
t.IntegerData * 8 / 1024 AS growth_mb, t.Duration / 1000 AS duration_ms, t.StartTime
FROM sys.fn_trace_gettable(@path, DEFAULT) t
JOIN sys.trace_events te ON t.EventClass = te.trace_event_id
WHERE te.name IN ('Data File Auto Grow', 'Log File Auto Grow')
ORDER BY t.StartTime DESC;
5. Verify recovery
- Run the file query from step 1 again.
used_mbshould be belowsize_mb, or there should be headroom tomax_mb. - No new 1105 or 1101 entries in
xp_readerrorlogfor at least 30 minutes. - Application error rates are back to baseline, and queued work or jobs have caught up.
- If you added a file, add it to the documentation and to the restore scripts. Any
RESTORE ... WITH MOVEnow needs the extra file.
Communicate
Tell users that writes to the database failed between the first and last 1105 timestamps, and that reads were not affected. Ask application owners to check for failed transactions that their code does not retry automatically, such as orders, messages or batch loads.
Prevent it next time
- Alert on two numbers: data-file used space against
max_size(for example, above 85%) and volume free space (for example, below 15%). Don't rely on autogrow alone. - Use fixed-MB growth, not percent growth, on large files. Enable IFI by granting the service account "Perform volume maintenance tasks".
- Review every
MAXSIZEcap. If a cap exists, give it an owner and an alert. - Put retention and purge jobs on staging and logging tables, and alert when those jobs fail.
- Add 1105 and 1101 to your SQL Agent alerts:
EXEC msdb.dbo.sp_add_alert @name = N'Error 1105 - filegroup full', @message_id = 1105, @severity = 0, @include_event_description_in = 1;
EXEC msdb.dbo.sp_add_notification @alert_name = N'Error 1105 - filegroup full', @operator_name = N'DBA Team', @notification_method = 1;
An alert on @message_id only fires for messages that are written to the error log. Check the is_event_logged flag, and turn it on with sp_altermessage if it is off:
SELECT message_id, severity, is_event_logged
FROM sys.messages WHERE message_id IN (1101, 1105) AND language_id = 1033;
-- If is_event_logged = 0:
EXEC sp_altermessage 1105, 'WITH_LOG', 'true';
Test the alert once on a small test database that has a low MAXSIZE cap.
Get the weekly HubDatAI email
One email a week with everything new: posts, learning sessions and videos. Free, no spam, unsubscribe in one click. What you get