MDF (SQL) database file is over 88 GB and i have no idea why!
With some reason my sql database file exploded to become o开发者_StackOverflowver 88 GB and i can't see a reason why. i run few scripts to search for large tables, found nothing to be too big. i also tried to run shrink database (which did nothing) and shrink files (which return an error).
has anyone has any idea what else i can do?
Thanks.
First thing I'd check (if you've already checked the table and index sizes and still see a big difference) is the file properties.
In SQL Server Management Studio, go to the Object Explorer, right click on your database in question and do "Properties", and then go to the "Files" tab.
What files do you have? What are their settings, especially the "Autogrowth" settings?? If a data file gets close to filling up, SQL Server will expand it, in a way defined in those settings - if you define that 50GB should be added to the file, and the disk space is available, SQL Server will happily oblige and do so - even if it needs just a few hundred extra bytes.
The MDF (data file) or the LDF (log file)?
If you're running in the Full Recovery Model, then your log file may be growing and growing, until you back it up (at which point it will empty it out).
Otherwise, you could try looking for what's taking the space, with:
select *
from sys.allocation_units;
And bear in mind that you could have empty space in your database files. Your 'Shrink Files' dialog would've shown you the percentage free space.
精彩评论