Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Question regarding database backups

Author  Topic 

rockstar283
Yak Posting Veteran

96 Posts

Posted - 2013-10-21 : 20:34:53
I am learning about database backups in SQL server 2008.

I took a full database backup using following query:

BACKUP DATABASE TEST_DB TO DISK='D:\TEST_DB.bak'

The above query created a BAK file on D drive whose size is 2.5mb

Processed 304 pages for database 'TEST_DB', file 'TEST_DB' on file 1.
Processed 2 pages for database 'TEST_DB', file 'TEST_DB_log' on file 1.
BACKUP DATABASE successfully processed 306 pages in 0.039 seconds (61.110 MB/sec).
I immediately ran differential backup query on the same database:

BACKUP DATABASE TEST_DB TO DISK='D:\TEST_DB.bak' WITH DIFFERENTIAL

now the BAK size increased to 2.95 mb

Processed 40 pages for database 'TEST_DB', file 'TEST_DB' on file 2.
Processed 1 pages for database 'TEST_DB', file 'TEST_DB_log' on file 2.
BACKUP DATABASE WITH DIFFERENTIAL successfully processed 41 pages in 0.011 seconds (29.119 MB/sec).

What I don't understand is that I did not make any changes to the database between the two backups, then how come differential backup increase the size of the BAK file?

Can anyone please explain me..m confused

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2013-10-21 : 20:41:49
Because you are using the same file name and are not including the WITH INIT option. So it appended the full backup AND the differential into one file. Use a different file name, and I recommend never appending files (meaning always use WITH INIT option).

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

rockstar283
Yak Posting Veteran

96 Posts

Posted - 2013-10-21 : 20:46:57
Thanks for the reply mate..I ran the same queries WITH INIT option..but still got different file size..
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2013-10-22 : 12:05:51
Well what file sizes did you get this time? And please use a different file name for each command so that you aren't overwriting the file each time you run the command.

There is going to be some overhead data in each file so the differential is never going to be 0 in size even if you didn't make any changes. Your database is so small that we might be near the overhead size.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -