Are the Native SQL Server Backup Utilities Holding You Back?


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Are the Native SQL Server Backup Utilities Holding You Back?

  1. 1. Are the Native SQL Server Backup Utilities Holding You Back? Jason Hall Manager, Database Systems Consulting
  2. 2. 2 Confidential Dell Software Agenda • Introductions – Speaker – Topic • Native Backup/Restore Limitations and Considerations – Full vs. Diff Backups – Backup Job Management – Backup Reporting – Backup Reliability – Always On Availability Groups – Restoring Only What You Need – Backup Security • Q&A Taken Throughout via GoToMeeting
  3. 3. 3 Confidential Dell Software Who Are These Guys? • Jason Hall: Manager, Database Systems Consulting • David Gugick: Senior Product Manager, Backup and Recovery Solutions • Started w/ LiteSpeed in 2004 • Helped customers architect backup and recovery solutions • Frequent speakers at SSUG’s and Conferences • Always available – @jasonfhall or – @davidgugick or
  4. 4. 4 Confidential Dell Software What Are We Going to Talk About? • Microsoft has always provided a very capable B&R solution • Comes with limitations • Several facts that must be considered when implementing • Explore what those limitations and considerations are while offering suggestions on how to work around • Lots of demo’s!!!
  5. 5. 5 Confidential Dell Software Native Backup Limitations
  6. 6. 6 Confidential Dell Software Full vs. Differential Backups
  7. 7. 7 Confidential Dell Software Full vs. Differential Backups • Deduplication? • Seems like a no brainer right? • Differential backup challenges – Reliance on full backup – Effectiveness is dependent on amount of data change – Backup retention gets much more complex
  8. 8. 8 Confidential Dell Software Reliance on Full Backup • A differential backup without its associated full is useless • Scenarios that can affect the full backup – File is mistakenly deleted – File is moved to an unknown or inaccessible location – File moved to tape and shipped offsite – A new full backup (w/out COPY_ONLY) is taken – File has become corrupted or unrecoverable
  9. 9. 9 Confidential Dell Software Amount of Data Change • Differential backups only make sense when a small % of data has changed • Situations where data can change: – Unusual application activity – Unscheduled data loads/purges – Database Maintenance (Index Rebuilds) • Lots of change means large Differential backups – You don’t save time, space, and… – It can double (or worse) your recovery time
  10. 10. 10 Confidential Dell Software File Retention • Ensure that you are not deleting Full’s that are required for Diff/Log restores • Full on Sunday, Diff’s Mon – Sat, Don’t delete older than 3 days • If 2nd Full Backup fails, make sure previous full is not deleted. – F – D – D – D – F (failed) – D – D (still good, just points back to first full)
  11. 11. 11 Confidential Dell Software Tips & Tricks • If you are going to incorporate Differential backups… • For out of cycle Full backups, use COPY_ONLY – Or ensure that new full is a part of retention policy – BACKUP DATABASE AdventureWorks TO DISK=…. WITH COPY_ONLY • Perform data loads/purges before scheduled Full – Or perform out of cycle full after complete • For large index maintenance operations, perform before scheduled Full – Or perform out of cycle full after complete • If verifying or testing restores, test going back to full • Make sure retention policies are set to not delete full backups until new successful full
  12. 12. 12 Confidential Dell Software Backup Job Management
  13. 13. 13 Confidential Dell Software Backup Job Management • Many ways to run scheduled database backups – SQL Server Agent Jobs – SQL Server Maintenance Plans – Custom Scripted TSQL Jobs – Windows Scheduled Tasks – Typically only used for SQL Express – Centralized 3rd Party Scheduler – Enterprise Backup System – IBM Tivoli TSM – Symantec NetBackup – Dell NetVault Backup
  14. 14. 14 Confidential Dell Software SQL Server Agent Jobs • Need to be managed on a per server basis – Can be very challenging in large environments • SQL Server Maintenance Plans cannot be easily transferred between servers – SSIS Packages w/ hard coded connection strings – Manually create them on each server • TSQL Scripts can provide portability – Might need to run differently per version of SQL Server – Need a solution to copy/deploy – May be complex depending on amount of custom logic required
  15. 15. 15 Confidential Dell Software Example Script DECLARE db_cursor CURSOR FOR SELECT name FROM master.dbo.sysdatabases WHERE name NOT IN ('master','model','msdb','tempdb') -- exclude these databases OPEN db_cursor FETCH NEXT FROM db_cursor INTO @name WHILE @@FETCH_STATUS = 0 BEGIN SET @fileName = @path + @name + '_' + @fileDate + '.BAK' SET @backupstr = 'BACKUP DATABASE ' + @name + ' TO DISK = ' + char(39) + @fileName + char(39) EXECUTE (@backupstr) FETCH NEXT FROM db_cursor INTO @name END CLOSE db_cursor DEALLOCATE db_cursor
  16. 16. 16 Confidential Dell Software Ways to Deploy • SSMS has Group Execute – Add the script as a job to one SQL Server – Export Job as a TSQL Script – Group Execute against all, or a sub group of servers
  17. 17. 17 Confidential Global Marketing Demo
  18. 18. 18 Confidential Dell Software Backup Job Management Considerations • Different backup directories for different servers • Spreading or staggering backup schedules • Notification • Different database types
  19. 19. 19 Confidential Dell Software Backup Reporting
  20. 20. 20 Confidential Dell Software Backup Reporting • SQL Server stores backup statistics in a set of local MSDB tables. • SSMS has a very inflexible report available – Easier and more powerful to query yourself • Backup failures are logged locally to: – SQL Agent Job Step Logs – SQL Server Error Logs – Windows Event Logs
  21. 21. 21 Confidential Dell Software Backup Reporting Challenges • Backup statistics are only stored locally on the instance being backed up • If you have 100 servers and you want to report on all of your backups, have to run 100 reports • SSMS Group Execute can help here • Or you can build a reporting architecture to aggregate this data
  22. 22. 22 Confidential Dell Software Example Backup Report Query • Query msdb.dbo.backup… tables adding filtering and sorting
  23. 23. 23 Confidential Dell Software Demo
  24. 24. 24 Confidential Dell Software Backup Reliability
  25. 25. 25 Confidential Dell Software Backup Reliability • Native SQL Server backups and restores can be very “fragile” • Any IO related issue whether network or local will cause a failure – Only choices are: – Do we take a backup that conflicts w/ production workload? – Or, do we go the day without a backup and keep our fingers crossed?
  26. 26. 26 Confidential Dell Software Backup Reliability Tips • When backing up over the network: – Make sure the network is reliable – Stagger backups that share the same network to avoid saturation – Look into possibly routing backups over a dedicated network infrastructure • If you cannot backup over the network: – Make sure you have plenty of local disk allocated – Backup to a disk other than where your data/log files are – Copy the backup across the network – Consider using a more robust option than COPY – ROBOCOPY – Provides fault tolerance and multi threading
  27. 27. 27 Confidential Dell Software AlwaysOn Availability Groups
  28. 28. 28 Confidential Dell Software AlwaysOn Availability Groups • Against Secondary Replica’s – Only Full (COPY_ONLY) and Log backups are supported – No differential backups or standard full’s are allowed. • Backup preference should be set to enforce policy or avoid license violation • Backup preference can be enforced through a MP – Not through BACKUP DATABASE – Not through Backup Wizard • Check sys.fn_hadr_backup_is_preferred_replica
  29. 29. 29 Confidential Dell Software Demo
  30. 30. 30 Confidential Dell Software Restoring Only What You Need
  31. 31. 31 Confidential Dell Software All Or Nothing Restore • Restore types mirror backup types – Full – Diff (Full + Diff) – Log (Full + Log(s)) – Filegroup (Full + Log) • What if you only need a subset of data (i.e. Table, Stored Proc, Record, etc...)?
  32. 32. 32 Confidential Dell Software Recovery Tips • Restore to separate server and grab what you need – Requires time and space • Proactive Solutions – AlwaysOn? – No – Log Shipping Load Delay – Database Snapshots
  33. 33. 33 Confidential Dell Software Demo
  34. 34. 34 Confidential Dell Software Backup Security
  35. 35. 35 Confidential Dell Software Backup Security • Native SQL Server backups are created in plaintext • Can be read by any hexeditor (even notepad) • Used to be able to password protect backups (no longer available in 2012) • Compression can make it harder to read, but still possible • TDE Encrypts whole database (including backup) – Has many implications • Consider if and how backup data should be secured/encrypted
  36. 36. 36 Confidential Dell Software Demo
  37. 37. 37 Confidential Dell Software How Can Third Party Solutions Help • Backup Templates and Enterprise Reporting • Object Level Recovery • Up to AES 256 Encryption
  38. 38. 38 Confidential Dell Software Summary • Hopefully we’ve given a lot of food for thought!! • How can we (Dell Software) help? – NetVault LiteSpeed for SQL Server – demonstration819145.aspx
  39. 39. 39 Confidential Dell Software Q&A Thank You!!!