Could not Allocate space for Object because Primary Filegroup Is Full Error – SQL Server

One of my clients mailed me today about a SQL Server error.

SQL Error
Could not allocate space for object 'dbo.TableName' in database 'SomeDB' 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.

Now there multiple ways to resolve this error, as suggested above, in the error message itself. Here are some steps that I thought of sharing with my readers:

1. Check the disk space to see if there is sufficient space. If not, delete some files to create space.

2. Check if you have restricted the growth of your data and log file. Right click the database in Management Studio > Properties. Go to the ‘Files’ tab and you will see a similar screen


Change it to unrestricted growth for your data and log file. Remember that Autogrowth does not guarantee that your files will not run out of space. Also make sure to use a static increment as opposed to a percentage increment. Here’s a very good article Considerations for the "autogrow" and "autoshrink" settings in SQL Server

3. Lastly you can shrink the database (DBCC SHRINKDATABASE) or shrink the files (DBCC SHRINKFILE). Do not set AutoShrink on Production databases.

Note: I have seen this error occurs on hard disks formatted with the FAT32 filesystem. Remember that FAT32 has a 4GB file size limit. Changing the file system to NTFS sometimes resolves the issue.

About The Author

Suprotim Agarwal, MCSD, MCAD, MCDBA, MCSE, is the founder of DotNetCurry, DNC Magazine for Developers, SQLServerCurry and DevCurry. He has also authored a couple of books 51 Recipes using jQuery with ASP.NET Controls and a new one recently at The Absolutely Awesome jQuery CookBook.

Suprotim has received the prestigous Microsoft MVP award for nine times in a row now. In a professional capacity, he is the CEO of A2Z Knowledge Visuals Pvt Ltd, a digital group that represents premium web sites and digital publications comprising of Professional web, windows, mobile and cloud developers, technical managers, and architects.

Get in touch with him on Twitter @suprotimagarwal, LinkedIn or befriend him on Facebook

No comments: