SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Question regarding database backups
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rockstar283
Yak Posting Veteran

90 Posts

Posted - 10/21/2013 :  20:34:53  Show Profile  Reply with Quote
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

USA
36845 Posts

Posted - 10/21/2013 :  20:41:49  Show Profile  Visit tkizer's Homepage  Reply with Quote
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

90 Posts

Posted - 10/21/2013 :  20:46:57  Show Profile  Reply with Quote
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

USA
36845 Posts

Posted - 10/22/2013 :  12:05:51  Show Profile  Visit tkizer's Homepage  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000