Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is SQL Server backup so much larger than the DB files?

Tags:

I have a SQL Server DB that is about 13Gb with a 1.6Gb log file. When I back it up, however, it creates a 50Gb .bak file! Why is that?

I have read some commentary here about transaction logs, but my DB runs on my laptop and there is no DB activity during the time of the backup. (It only takes 5 minutes).

My backup type is Full, my recovery type is Full, and I am doing Copy-Only backups. Any ideas? Much appreciated!

I am using SQL 2008 R2, Developer Edition.

like image 923
DatsunBing Avatar asked Nov 03 '10 08:11

DatsunBing


People also ask

Why is my SQL backup so big?

If it is the backup that keeps growing and growing, I had the same problem. It is not a 'problem' of course, this is happening by design - you are just making a backup 'set' that will simply expand until all available space is taken. To avoid this, you've got to change the overwrite options.

How do I reduce the size of a SQL backup file?

To shrink a data or log file. In Object Explorer, connect to an instance of the SQL Server Database Engine and then expand that instance. Expand Databases and then right-click the database that you want to shrink. Point to Tasks, point to Shrink, and then select Files.

Should I shrink database before backup?

You shouldn't be shrinking your database unless you had an unusually large transaction go through. If you shrink the logs they will grow right back to the same size.


1 Answers

It might be because the backup routine is appending the new backup to the same file?

There is an option in the Backup dialog in Sql Management Studio to Append or Overwrite all existing backup sets. If you have Append if will add the backup to the same .bak file and the .bak file will be larger for every backup.

In Transact Sql it is the INIT and NOINIT option which determine if the bak file is overwritten or appended.

like image 153
BTB Avatar answered Sep 19 '22 15:09

BTB