Home SQL Server Errors 1105
Microsoft SQL Server

SQL Server Error 1105

Could not allocate space because the filegroup is full

Severity 17 Resources
Applies to: SQL Server 2005 to 2022, Azure SQL Managed Instance
The full message
Msg 1105, Level 17, State 2, Line 1
Could not allocate space for object 'dbo.Orders' in database 'AppDb' because the 'PRIMARY' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.

Why it happens

Error 1105 is about the DATA file, not the log file. It means SQL Server tried to allocate a new page for a table or index inside a filegroup and there was nowhere to put it. Unlike error 9002, which fires when the transaction LOG file is full, 1105 fires when the data file (usually in the PRIMARY filegroup) has run out of room.

The message names the object, the database, and the full filegroup: the 'PRIMARY' filegroup is full. A data file only grows when autogrowth is enabled and there is space to grow into, so 1105 appears when one of three things is true.

Common causes are that the data file reached its configured maximum size or has autogrowth disabled, the disk holding the file is physically full so it cannot grow further, or a filegroup other than PRIMARY that a table is mapped to has filled up. The error is severity 17, meaning the server ran out of a resource; the statement fails and rolls back rather than corrupting anything.

Examples

The data file hit its maximum size

-- Data file capped at 100 MB with autogrowth off.
-- A large insert exhausts the remaining pages.
INSERT INTO dbo.Orders (customer_id, total)
SELECT customer_id, total FROM staging.Orders;
Result
Msg 1105, Level 17, State 2, Line 3
Could not allocate space for object 'dbo.Orders' in database 'AppDb' because the 'PRIMARY' filegroup is full.

Check file sizes and free space inside each file

SELECT name AS logical_name,
       type_desc,
       size / 128.0 AS size_mb,
       CAST(FILEPROPERTY(name, 'SpaceUsed') AS INT) / 128.0 AS used_mb,
       (size - CAST(FILEPROPERTY(name, 'SpaceUsed') AS INT)) / 128.0 AS free_mb,
       max_size,
       growth
FROM sys.database_files;
Result
-- No error. This shows which data file is full and
-- whether it can still grow (max_size and growth columns).

Check overall space use with DBCC SQLPERF

-- Log space use across databases (companion check).
DBCC SQLPERF(LOGSPACE);

-- For data files, inspect free space per file:
DBCC SHOWFILESTATS;
Result
-- No error. Use these to confirm whether the shortage is
-- in the data file (1105) or the log file (9002).

How to fix it

Free disk space or enable and increase autogrowth

If the disk still has room, let the data file grow. Turn autogrowth on, give it a sensible growth increment, and raise the maximum size so the file can expand when it fills.

ALTER DATABASE AppDb
    MODIFY FILE (
        NAME = 'AppDb',
        FILEGROWTH = 256MB,
        MAXSIZE = 50GB
    );

Add another data file to the filegroup

When the current drive is full, add a second data file to the same filegroup on a drive that has space. SQL Server spreads new allocations across the files in the filegroup.

ALTER DATABASE AppDb
    ADD FILE (
        NAME = 'AppDb_2',
        FILENAME = 'E:\\SqlData\\AppDb_2.ndf',
        SIZE = 2GB,
        FILEGROWTH = 256MB
    ) TO FILEGROUP [PRIMARY];

Archive or delete unneeded data and reclaim space

Remove data you no longer need, then rebuild indexes so the freed pages become usable. Use TRUNCATE TABLE for full clears and rebuild to compact the used space.

-- Remove old rows, then reclaim their space.
DELETE FROM dbo.Orders WHERE order_date < '2020-01-01';

ALTER INDEX ALL ON dbo.Orders REBUILD;

Move the data file to a bigger disk

If the drive is simply too small, relocate the file. Point the file at a larger disk, then take the database offline and back online so SQL Server picks up the new path.

ALTER DATABASE AppDb
    MODIFY FILE (
        NAME = 'AppDb',
        FILENAME = 'F:\\SqlData\\AppDb.mdf'
    );

-- Then copy the file to the new path and:
ALTER DATABASE AppDb SET OFFLINE;
ALTER DATABASE AppDb SET ONLINE;

How to prevent it

Monitor data file free space and disk capacity so you see a filegroup filling up before it stops writes. Alert on percent used per file and on drive free space, not just on total database size.

Set sensible autogrowth increments and a realistic MAXSIZE on every data file, and plan capacity ahead of large loads. Because 1105 and 9002 both stem from running out of room, treat data and log growth together when you size a database. For how transactions interact with these files, see SQL transactions and ACID explained.

Common questions

What is the difference between error 1105 and error 9002?

Error 1105 means a DATA file or filegroup is full, so SQL Server cannot allocate pages for a table or index. Error 9002 means the transaction LOG file is full. They point to different files: fix 1105 by growing the data file or adding a data file to the filegroup, and fix 9002 by clearing or growing the log.

Why does autogrowth matter for error 1105?

A data file only expands when autogrowth is enabled and there is disk space and headroom under MAXSIZE to grow into. If autogrowth is off or the file has reached its maximum size, the filegroup fills and SQL Server raises 1105 even when the disk itself has free space.

How do I find which data file is full?

Query sys.database_files to compare each file size against its used space and max_size, or run DBCC SHOWFILESTATS. The file with almost no free space and either autogrowth off or size at max_size is the one causing error 1105.

Still stuck on a SQL Server error?

Browse the full SQL Server error library, or get hands-on help from an experienced SQL professional.