Can anyone give a solution for this error:

Could not allocate space for object ‘object_name’ in database ‘database_name’ 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.

How can I delete files from primary file group?

4 Answers 4


You need to do one or more of 3 things:

  1. Increase the max file size of the file
  2. Increase the disk space wherever your .mdf & .ndf files are stored
  3. Delete data from your database to free up space for the new object

Right click on your Database > Properties > Files.

Here you will see the file names, file groups, path, and importantly the Autogrowth / Maxsize. If you have it set to Limited to ... then it can't grow beyond this limit. If the file is full, you will either need to change the Maxsize or delete data from your database. If the file isn't full, then your disk could is almost certainly full and you'll need to add space there.

Also, don't shrink your database in an attempt to fix this.


You could delete data from tables etc, but most likely if your data has grown to that size it will need the space now or in the near future.

If you have space in the drive where the file sits, increase the file size for that DB and consider switching on auto growth (check growth increment and max size settings are reasonable for your set-up) if not already.

If the drive is out of space, it’ll need to be increased or it will almost definitely be a problem soon.


As extension to other answers.

This is what might causing the error or your system storage drives are full! enter image description here

How can I delete files from primary file group.

it doesn't mean deleting files, PRIMARY file group is something hosting complete database objects and it's data along with indexes. error indicate that you may delete 'objects' or 'Indexes' or data from tables in the database.

If system drive it-self full, you may free-up space by deleting unwanted files from the system.


How to proceed in these kind of issues :

Step 1 : Check the disk space where the data files reside. If you are running out of disk space. There is the problem.You will have to either increase the disk space in that drive or you will have to create a secondary file into a drive with sufficient space available while limiting growth in mdf.Adding an ndf file and disabling autogrowth on the primary mdf will solve the problem for that moment.

If you see sufficient disk space then it it something to do with the database settings.

Step 2 : Right click the database to check the properties.Go to files page :

Check if Autogrowth is enabled or not. If autogrowth is not enabled and the datafile has reached the limit, you will receive primary file group full error.

  • Tick the checkbox to enable AutoGrowth

If you find it set to 'Limited',then either increase the limit you can afford the db to grow or make it unlimited.

Learn more about Autogrowth click here

enter image description here

Deleting data from tables can be done once the main problem is fixed. Also data deletion is not an option when you are taking care of Production systems. Deleting data fill not shrink your data file itself, you will need to re-index and shrink it manually if needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.