![]() |
|
|
By: Jeremy Kadlec | Read Comments (3) | Print Jeremy is the CTO @ Edgewood Solutions, co-founder of MSSQLTips.com and SQL Server MVP since 2009. Related Tips: 1 | 2 | 3 | 4 | More |
|
Problem
I know the 'typical' backups are full database backups executed every day. I have looked into transaction log backups and I am not sure if that is something I can support. I have seen some information on differential backups, but I am not sure exactly how they work, how they are different and how they could help me? Could you please explain some of the considerations with differential backups to determine if they would be beneficial to me and my situation?
Solution
Depending on the frequency of data changes in your SQL Server database(s) and the amount of time\data that your business is willing to lose, should dictate your overall backup strategy. If a days worth of data is acceptable to lose, then using the full backup strategy could be a viable one, if not, then you need to start looking into differential and transaction log backups. Regardless of the situation, make sure you understand the business needs and make sure your backup and recovery solution will meet the needs. Unfortunately, Murphy's law will kick into place one of these days and having the right solution in place can make all of the difference in the world for you and your organization.
Should I consider differential backups in my overall backup strategy?
As far as the differential backups are concerned, they are a viable backup option and may or may not be helpful in a number of situations (see the advantages and disadvantages section below). Understanding how the differential backups work and how the recovery process would work is vital when you need to restore your databases in short order and get your SQL Server back up and running.
How do the differential backups work from a backup perspective?
What is sample syntax for a differential database backup?
|
SQL Server 2005 |
| BACKUP DATABASE AdventureWorks TO DISK = 'C:\Temp\DatabaseBackups\AdventureWorks_Full.bak' GO BACKUP DATABASE AdventureWorks TO DISK = 'C:\Temp\DatabaseBackups\AdventureWorks_Diff_1.bak' WITH DIFFERENTIAL BACKUP DATABASE AdventureWorks TO DISK = 'C:\Temp\DatabaseBackups\AdventureWorks_Diff_2.bak' WITH DIFFERENTIAL |
|
SQL Server 2000 |
| BACKUP DATABASE Northwind TO DISK = 'C:\Temp\DatabaseBackups\Northwind_Full.bak' GO BACKUP DATABASE Northwind TO DISK = 'C:\Temp\DatabaseBackups\Northwind_Diff_1.bak' WITH DIFFERENTIAL BACKUP DATABASE Northwind TO DISK = 'C:\Temp\DatabaseBackups\Northwind_Diff_2.bak' WITH DIFFERENTIAL |
How do the differential backups work from a restore perspective?
Depending on your backup schedule and the time when the failure occurred would dictate the detailed steps that would need to be taken. If you need to have your current SQL Server databases back up and running, then the full backup would be restored followed by the last differential and then transaction logs if you are issuing them.
If you are trying to keep 2 SQL Servers in sync via differential backups, then at a high level, the full backup would need to be restored followed by the differential backups.
What is the sample syntax for a differential database restore?
|
SQL Server 2005 |
| RESTORE DATABASE AdventureWorks FROM DISK = 'C:\Temp\DatabaseBackups\AdventureWorks_Full.bak' WITH NORECOVERY GO RESTORE DATABASE AdventureWorks FROM DISK = 'C:\Temp\DatabaseBackups\AdventureWorks_Diff_1.bak' WITH NORECOVERY RESTORE DATABASE AdventureWorks FROM DISK = 'C:\Temp\DatabaseBackups\AdventureWorks_Diff_2.bak' WITH RECOVERY |
|
SQL Server 2000 |
| RESTORE DATABASE Northwind FROM DISK = 'C:\Temp\DatabaseBackups\Northwind_Full.bak' WITH NORECOVERY GO RESTORE DATABASE Northwind FROM DISK = 'C:\Temp\DatabaseBackups\Northwind_Diff_1.bak' WITH NORECOVERY RESTORE DATABASE Northwind FROM DISK = 'C:\Temp\DatabaseBackups\Northwind_Diff_2.bak' WITH RECOVERY |
What are the advantages and disadvantages for using differential database backups and restores?
Next Steps
| Share: | Share | Tweet |
|
![]() |
|
|
Free SQL Server Learning |
| Friday, July 11, 2008 - 9:16:56 AM - bkshilo | Read The Tip |
|
I disagree with the RESTORE example. After restoring the full backup file, you should only have to restore the 2nd differential backup file. |
|
| Friday, July 11, 2008 - 1:49:23 PM - admin | Read The Tip |
|
bkshilo, You are correct, if you need to get to the most recent point in time, only the last differential backup is needed, not each of the individual differential backups. In the circumstance I was faced with, we used differential backups as a means to perform pseudo log shipping. What I mean by this is differential backups were taken and applied to backup systems as a means of DR\HA solution for a specific set of applications. So rather than having to worry about applying logs, differential backups\restores were automated and the customer was willing to lose data in between failovers as long as the failover was very fast and required minimal manual intervention. In the situation I was in, only a RESTORE DATABASE [NAME] WITH RECOVERY command was needed (as opposed to figuring out the correct differential backup file to restore) to bring the database online which was completed as a portion of the bigger application failover process. SQL Server was just one piece of the process. This was a unique situation from my perspective for a number of reasons, so please let me know if that explanation makes sense. Thank you, |
|
| Monday, April 26, 2010 - 1:08:01 PM - sql_noob | Read The Tip |
|
we do all differential back ups where i work and no log backups. the size issue is the worst thing. i have some 300GB databases where the diff backup is 80% or more of the full backup size. since all of our backups are directly to tape i worked around this by having the expiration time for these backups being around 2 weeks. this way the tapes are always being cleared up. |
|
|
privacy | disclaimer | copyright | advertise | about authors | contribute | feedback | giveaways | user groups Some names and products listed are the registered trademarks of their respective owners. Edgewood Solutions LLC | MSSharePointTips.com | MSSQLTips.com |