I have a SQL Server database that has reached the 10 GB limit.
When I do use EXEC sp_spaceused, I get
| reserved | data | index_size | unused |
|---|---|---|---|
| 10483208 KB | 10352336 KB | 90264 KB | 40608 KB |
However when I do this query:
SELECT SUM(a.total_pages) * 8 AS TotalSpaceKB, SUM(a.used_pages) * 8 AS UsedSpaceKB, (SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB FROM sys.tables t JOIN sys.indexes i ON t.OBJECT_ID = i.object_id JOIN sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id JOIN sys.allocation_units a ON p.partition_id = a.container_id LEFT JOIN sys.schemas s ON t.schema_id = s.schema_id I get that the sum of the tables barely is 450 MB.
I've started getting this error when doing some procedures:
System.Data.SqlClient.SqlException (0x80131904): Could not allocate space for object 'sys.change_tracking_517680992' .'sys_change_cidx' from database '***' because filegroup 'PRIMARY' is full. Delete unnecessary files, remove objects from the filegroup, add additional files to the filegroup, or set the auto-growth option for existing files in the filegroup to create disk space.
So I guess it's logs or tracking files that are taking up the remaining space? Can I delete them somehow?