1

I have reached the file size limit on my SQL Server 2008 R2 Express database which I believe is 10Gb. I know this because I see Event ID 1101 in the event log.

Could not allocate a new page for database 'ExchangeBackup' because of insufficient disk space in filegroup 'PRIMARY'

I have removed some historic data to work around the problem for now but it is only a temporary fix. One table (PP4_MailBackup) is much larger than the others so when I created this database 12 months ago, I converted this table to be a Filestream table and the data is stored outside the FileGroup in the File System. This appeared to be working successfully until I received the error and new data was no longer being added to my database.

When I do a report on table sizes I see the Reserved(KB) column adds up to almost 10GB.

The folder that holds my FileStream data is 176 GB

The database .mdf file is indeed 10GB.

Does anyone have any idea why the table PP4_MailBackup is still using nearly 7GB?

Here is the "Standard Reports -> Disk Usage report" for this database:

Thanks in advance

David

enter image description here

Update

Here is some more info.

There are 868,520 rows in this table.

This cmd returns 1 so I'm assuming Ansipadding is on. I have never changed this from the default.

SELECT SESSIONPROPERTY('ANSI_PADDING')

The columns are defined like this

enter image description here

Even if every record for every column filled the full record size, by my rough calculation the table would be around 4,125,470,000 bytes. I understand that the nvarchar columns only use the actual space required.

I'm still missing a lot of space.

David P
  • 411
  • 7
  • 21
  • The table seems to explain clearly why this table is taking up `7GB`. As a side note, the LDB files may also be counting towards the 10GB storage limit for your database. – Tim Biegeleisen Aug 14 '17 at 01:58
  • Hi Tim, The attachment explains that the PP4_Mailbackup Table IS using 7GB but it doesn't explain WHY. This Table is file stream enabled. Should I expect a 176GB file stream Table to still occupy 7GB in the database? The log file is not part of the filegroup so I doubt it is included. It is 1GB at the moment. I regularly backup this database so I'll investigate why the log isn't being truncated. – David P Aug 14 '17 at 03:21
  • The log file is mostly free space so it is being managed correctly. I see no point in shrinking it. – David P Aug 21 '17 at 00:50

1 Answers1

0

Not really an answer but more of a conclusion.

I have given up on this problem and resided myself to remove data to stay under the 10GB Primary file size limit. I figured out that the nvarchar columns store 2 bytes per character in order to deal with Unicode characters although they do only use the space required and don't pad out the column with spaces. So this would account for some of the space I can't find.

I tried to convert my char(500) columns to varchar(500) by adding new columns with the correct type copying data into them and then removing the old column. This worked but the table actually got bigger because removing the column is only a Meta data change and does not actually remove the data. To recover the space I would need to create a new table and copy the data across then remove the old table of course I don't have enough space in the primary file to do that.

I thought about copying the table to temp db removing the original table then copying it back but temp db doesn't support filestream columns (at least to my knowledge) so I would need to hold all 170GB within the temp db table. This sounded like a dubious solution and my test server didn't have enough space on the partition where temp db was stored. I couldn't find anything on the files size limit of tempdb on sql 2008 Express, but at this point it was all getting too hard.

David P
  • 411
  • 7
  • 21