SQL Server differential backup file size smaller than previous one? - sql-server

I have a production system running on an SQL Server 2008 DBMS, in Full recovery mode.
I take a full backup each day at midnight, a log backup every two hours, and a differential backup every 6 hours (06:00, 12:00, 18:00, but not midnight as the full is taken then).
In recent days however I've noticed that the diff backup filesize of 18:00 is smaller than the one of 12:00. And sometimes, the one of 12:00 is smaller than the 06:00 ...
I did not experience this behavior until recent days.
Reading from the Microsoft doc, the filesize of a diff backup should always be larger than the previous one, until a new full backup is taken.
Could anyone have a possible explanation what could be causing this ?
Thanks.

I had a similar situation. I had a bit thought over it and reckoned it's caused by multiple backup jobs existing for the database, which means the differential backup was mislead by the wrong backup flag.

Related

Is there a way to keep on restoring SQL database backups periodically, and meanwhile access the database from another application?

I'm periodically getting backups of an SQL database which I would like to restore in my machine. I'm able to do that with RESTORE fullDB WITH NORECOVERY; RESTORE differentialDB WITH RECOVERY;
However, I need to access the restored database in between, as the interval in which I'm getting the backups can be a few hours.
I tried restoring full backup WITH RECOVERY, but in that case I'm getting exception while restoring differential backup.
NB: It's not just one differential backup, it's real time backups taken every few hours. I'm using C# for executing the operations.
Any help is appreciated to solve the issue. Also, let me know if I'm barking at the wrong tree.
Instead of sending SQL database backups from client as .bak files, should I opt any other way to send the data?
Take a look at the STANDBY option for the RESTORE statement. From the docs:
Specifies a standby file that allows the recovery effects to be undone.
NB - differential backups are based on the last full backup taken. So let's say that you take full backups on Sunday, differential backups every other day of the week and you're restoring every day.
Sunday, you'd restore only the full backup, bringing it online for read by specifying STANDBY with the restore
Monday through Saturday, you'd restore the latest differential backup on top of what you've already restored, again using STANDBY
When Sunday rolls around again, you'd need to restore the new full backup.
That said, you mentioned that you're on SQL Express. The database size limit is 10 Gb. At that size, how long does the restore of the full backup take? Is it worth your time? And even there, it's really "how much time are you saving the robot?" because you've already (presumably) automated the restore.

Automated Incremental backup sql only 5 days

This is my final hopes for expecting answer. Question is: How to do automated incremental backup in SQL Server only for 5 days? and how to schedule in task schedule tool. Please help me.
You might be confusing differential backups with incremental Backups.SQLServer doesn't have a concept of incremental backups..
You might get incremental effect (only backup what has been changed,from last backup) using Tlog*..Idea goes like this..
1.Take a Full Backup
2.Each day, by the end of day take Tlog backup
To Clarify,When you need to restore the backups /make database usable,you will need to restore Fullbackup ,followed by Tlog backups in order
*This is very Risky since ,it reduces your risk of restoring to a point in time
You can create a maintenance plan in SQL Server containing 2 parts:
A back up task for executing a backup every day (or every 5 days)
A clean up task for deleting all the backups older than 5 days.
Once created, you can plan it as a job in SQL Agent. Here's a great example about how to do it: Create a maintenance backup plan in SQL Server 2008 R2 using the wizard by Kyle Laffoon.

SQL Server 2008 R2 differential backups much larger than expected

We have several SQL Server 2008 R2 databases for which we perform a full backup every Sunday then differential backups Monday to Saturday. We also do transaction log backups every 10 minutes.
The first differential backup on Monday is usually quite small, but Tuesday to Saturday are much larger but similar in size to each other.
I used some scripts I found which predict the differential backup size, e.g. https://dougzuck.com/sql-differential-backup-size-prediction and http://www.sqlskills.com/blogs/paul/new-script-how-much-of-the-database-has-changed-since-the-last-full-backup/, and they predict a very much smaller backup size.
Examples are:
database1, full backup size 5Gb, diff size 3.5Gb, predicted diff size 84Mb
database2, full backup size 40Gb, diff size 1Gb, predicted diff size 17Mb
As you can see, the actual sizes are hugely different and can be half the size of the full backup after only a couple of days.
I know users aren't creating or modifying the actual data to any great extent. As far as I can tell, there are no index rebuilds or other management tasks happening between the full and differential backups.
It's like something is happening on Monday which causes the Tuesday onward differentials to be huge. Backup compression is not used.
Any ideas?? Thanks in advance.
Doug
How differential backup works..?
Whenever we take a differential backup,it copies all the changes which occured from last full backup,Not from Last differential backup..
That is the reason why you are seeing "actual sizes are hugely different and can be half the size of the full backup after only a couple of days"

When doing a scheduled differential backup every 30 minutes, should the filename always change?

I have a client that has a puzzling thing running on the MS SQL 2008 server. They have a backup job running every 30 minutes doing a differential backup.
The filename of the backup is the same, so am I right in thinking that the SQL Server 2008 will continuously overwrite this file? Should the filename be change dynamically on each backup run? My understanding is that the differential backup is the changes that occurred since the last full backup. So overwriting the backup each time doesn't make sense to me.
Another puzzling thing is at end of day they have a FULL backup scheduled, and a differential backup at the same time. My thinking would be that this is also incorrect.
The full backup can occur at end of day, and then differential backups could occur after that, but for them to happen at the same time doesn't make sense. What would the best practice be for 1 daily backup and then differentials throughout the day?

Restore DB to a point in time SQL SERVER 2008 R2

I have a sql server 2008R2 DB with FULL recovery.
A full backup done nightly at 2am (overwriting the previous night's .bak file)
Every hour I have a Transnational backup .trn files
The last full backup was done today at 3am Sept 21.
Today I was asked to make a copy of the database to a previous time Sept 20th 12PM.
I know how to restore from an older last full backup (say Sept 20 3am) and then apply the .trn files to bring it up to a certain point in time (backup with norecovery then apply trns).
But is it possible to go backwards in time in my situation given that the only full backup I have was taken 3am Sept 21st? if not please tell me how I can change my backup strategy to be able to do it in the future if I run into this again.
thanks
Not knowing much about your organization needs
I would suggest taking a FULL Backup every night.
Differential Backup every one hour and then transaction backup every 10 to 5 mins or
whatever suits your organization needs best
and SET Expirydate for your backups for 5 to 7 days so that new backup will not overwrite the backups for so many days.
I think if you make a Backup strategy for your databases like this it will be helpful in future to go back in in time.
One more tip "A LESSON learnt the hard way" DO NOT FORGET to backup (master, model, msdb)
even once a week but make sure you have some sort of plan in place to backup these database.
I hope this reply will be helpful
Regards
Mo

Resources