Backup beyond just a strategy with SQL Server


Published on

Webcast delivered for the series for ITPro.

Published in: Technology
1 Comment
  • how can i download this file plz tell me
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Backup beyond just a strategy with SQL Server

  1. 1. Backup beyond just a strategy with SQL Server<br />Vinod Kumar<br />Technology Evangelist<br />Microsoft Corporation<br /><br /><br />
  2. 2. Session Objectives and Takeaways<br />Session Objectives<br />Know some of the basics of SQL Server<br />What makes an effective Strategy for backup<br />Both from Technology Enhancements<br />Actual implementations<br />Takeaways<br />These as much as they look theoretical, We will view some of the fundamentals during the demo to make you realize how important backups are !!!<br />
  3. 3. Targeted Roles<br />Database Administration <br />Database Development <br />Database Operations and Support <br />Database Solutions Architect <br />
  4. 4. File Creation/Initialization<br />Creation of database files<br />Files being restored are created and initialized.<br />This step is NOT performed if file already exists.<br />Do not drop database prior to restoring it.<br />Time requirement<br />SQL Server 2000<br />Write throughput of data devices (disks, RAID controllers, etc.)<br />Same time as CREATE DATABASE or ALTER DATABASE ADD FILE<br />SQL Server 2005+ – Zero-initialization SKIPPED<br />
  5. 5. Data/Transaction Log Copy<br />File containing data or transaction log is copied from backup devices to destination<br />Length of this phase:<br />Amount of data or log to be copied<br />Slowest component of the I/O system (disk device, backup device, controller, PCI bus, network)<br />System tuned for maximum copy speed is limited by memory bus bandwidth—or before that, number of PCI buses or slots supported by system<br />CPU usage should be insignificant<br />
  6. 6. Redo<br />Redo (or roll-forward) occurs after the log has been restored.<br />Reads the transaction log.<br />Reapplies changes recorded in log to data pages so all pages are consistent with log.<br />Length of this phase is determined by…<br />Amount of log to redo (affected by type and frequency of backups), and<br />System performance.<br />Planning: How fast is redo relative to production workload?<br />
  7. 7. Undo<br />Undo is also called “roll-back” or “recovery.”<br />Begins after redo reaches it target point, often the point of failure.<br />Changes that were applied by active, uncommitted transactions at the target point are undone.<br />Length of this phase:<br />The amount of data modified by the active transactions<br />Planning: Very hard – depends on how transactions have been written and/or if long running transactions exist…<br />
  8. 8. Phases of Restore<br />File Creation/Initialization  Same as CREATE DATABASE<br />Minimized by Skipping zero-initialization<br />Data and/or Transaction Log Copy  Based on Media type and DB Size<br /> Minimized by Optimizing HW Configuration and Throughput<br />Redo/Roll-forward Log Type/Frequency of Backups<br />Minimized by SQL Server Transaction Log Information<br />Undo Uncommitted Transactions  Impossible to predict<br />Database Accessible upon REDO completion!<br />
  9. 9. Instant File Initialization<br />Skip data file zeroing<br />Create VLDB,<br />Add or grow file,<br />Initialize for restore,<br />…in seconds!<br />Security<br />Prior disk contents not overwritten until used<br />Extra care if SQL Server shut down or DB detached <br />Secure by default<br />Permission grantable only by Windows administrator<br />
  10. 10. Online Restore<br />SQL Server 2000<br />One damaged page/device/file ENTIRE database marked suspect, taken “offline”<br />Database is not available during restore<br />SQL Server 2005+ onwards<br />Database remains online<br />Only data being restored is unavailable<br />File/filegroup restore<br />
  11. 11. Piecemeal ManagementFine Grained Operations<br />Operations affect the minimum amount of data<br />Pages<br />Filegroups<br />Partitions<br />Data not involved remains<br />Available<br />Performant<br />
  12. 12. FilegroupsBasic unit of availability<br />Earlier Versions of SQL Server<br />Entire database<br />SQL Server 2005+<br />Database can be online, yet not all filegroups are available<br />
  13. 13. Available<br />Primary<br />Filegroup<br />Database<br />Filegroup A<br />Filegroup B<br />ExamplePiecemeal restore for disaster recovery<br />Online restore of filegroups in priority order<br />Backups<br />Primary<br />Log<br />Filegroup A<br />Filegroup B<br />
  14. 14. Piecemeal Backup-Restore<br />Partial database availability during restore<br />Based on file/filegroup backup<br />Works with all recovery models<br />Full, Simple, Bulk-Logged<br />Supported only for databases with multiple filegroups<br />Filegroups must be recovered to consistent point<br />
  15. 15. Short Restore SequenceFor Read-Only Data <br />Log backups need not be restored when…<br />File/filegroup is unchanged since backup<br />File has been rolled forward to where it is read-only <br />Useful for read-only tables or partitions<br />Set filegroup read-only<br />Recommended for FULL and BULK-LOGGED databases<br />Prevents inadvertent change<br />Prevents changes by background tasks<br />Required for SIMPLE model databases<br />Log backup for roll forward not available<br />
  16. 16. Primary Filegroup<br />Filegroup A<br />RESTORE<br /> DATABASE D…<br /> FILEGROUP=‘B’<br />Available<br />Restore Damaged FilegroupFull model database<br />Log Backups<br />Primary<br /> Backup<br />Database<br />Filegroup A<br /> Backup<br />Filegroup B<br />Backup<br />Filegroup B<br />Read - Only<br />Filegroup C<br />Backup<br />Filegroup C<br />Read - Only<br />
  17. 17. Recovery Models - Glance<br />Full <br />No work loss<br />Supports recovery to any point-in-time<br />Simple<br />Simplest backup/restore strategy<br />Simplifies log management<br />No log backups<br />Greatest work loss possible<br />No point-in-time recovery<br />No access to tail <br />Bulk_Logged<br />High performance bulk operations<br />Minimal log space for bulk operations<br />Some work loss exposure<br />Many large data warehouses fit this model<br />
  18. 18. Partial Backups<br />Two new types of backup<br />Partial Database<br />Similar to a full database backup, but contains only the read-write filegroups<br />Partial Differential<br />Similar to a full database differential, but contains only the read-write filegroups<br />Added to allow piecemeal restore of simple model databases<br />Also work with full and bulk-logged models<br />
  19. 19. Piecemeal Backup-RestoreSimple Model Databases<br />Required backups<br />Partial database backup<br />File or filegroup backups of read-only filegroups<br />Must be consistent with partial<br />Optional backups<br />Partial differential<br />File/filegroup differential<br />If filegroup normally read-only was changed, then made read-only again<br />
  20. 20. BACKUP<br /> DATABASE D…<br /> WITH PARTIAL<br />Primary Filegroup<br />Filegroup A<br />BACKUP<br /> DATABASE D…<br /> FILEGROUP=‘B’<br />BACKUP<br /> DATABASE D…<br /> FILEGROUP=‘C’<br />Piecemeal BackupSimple model database<br />Database<br />Partial<br /> Backup<br />Filegroup B<br />Backup<br />Filegroup B<br />Read - Only<br />Filegroup C<br />Backup<br />Filegroup C<br />Read - Only<br />
  21. 21. RESTORE<br /> DATABASE D…<br /> WITH PARTIAL<br />Primary Filegroup<br />Filegroup A<br />RESTORE<br /> DATABASE D…<br /> FILEGROUP=‘B’<br />Filegroup B<br />Read - Only<br />RESTORE<br /> DATABASE D…<br /> FILEGROUP=‘C’<br />Filegroup C<br />Available<br />Read - Only<br />Piecemeal RestoreSimple model database<br />Database<br />Partial<br /> Backup<br />Filegroup B<br />Backup<br />Filegroup C<br />Backup<br />
  22. 22. Primary Filegroup<br />Filegroup A<br />RESTORE<br /> DATABASE D…<br /> FILEGROUP=‘B’<br />Available<br />Restore Damaged FilegroupSimple model database<br />Database<br />Partial<br /> Backup<br />Filegroup B<br />Backup<br />Filegroup B<br />Read - Only<br />Filegroup C<br />Backup<br />Filegroup C<br />Read - Only<br />
  23. 23. Unavailable<br />RESTORE<br /> DATABASE D…<br /> WITH PARTIAL<br />Available<br />Restore Damaged PrimarySimple model database<br />Database<br />Partial<br /> Backup<br />Primary Filegroup<br />Filegroup A<br />Filegroup B<br />Backup<br />Filegroup B<br />Database Primary and A may be taken back in time without restoring filegroups B and C if B and C are consistent<br />Read - Only<br />Filegroup C<br />Backup<br />Filegroup C<br />Read - Only<br />
  24. 24. Damaged Page Tracking And Restore<br />Damaged pages encountered on read <br />Torn page or checksum error<br />Bad Page ID<br />Short read<br />Database remains available<br />Transaction rolls back<br />BUT error during rollback forces database restart<br />Damaged pages <br />Automatically tracked in a table<br />May be restored and recovered online<br />Works for databases with a single filegroup<br />
  25. 25. Page Restore Versus File Restore<br />Consider page restore when…<br />You have a limited number of damaged pages<br />You must maintain maximum availability<br />Consider file restore when…<br />A device is failing<br />You have large numbers of damaged pages<br />You need to relocate data to another device<br />You can tolerate the affected filegroupbeing unavailable<br />
  26. 26. Data Page Verification<br />Types<br />Torn page detection – 7.0 and 2000<br />Page checksum – NEW!<br />Page checksum<br />Detect disk I/O errors not reported by the hardware or operating system<br />When the checksum is verified<br />Retries eliminate transients <br />If verification fails,<br />A unique error is raised <br />Connection is terminated<br />Page is tracked<br />
  27. 27. Backup Verification<br />Detect errors unreported by the backup devices or operating system<br />Backup checksums are optionally generated<br />Verified by<br />RESTORE<br />RESTORE VERIFYONLY<br />Backup optionally validates page checksums if these are present<br />Optionally continue past page checksum errors to complete the backup<br />
  28. 28. Continue Past Restore Errors<br />Why?<br />A damaged backup may be the only one available<br />Continue past errors encountered by<br />RESTORE<br />RESTORE VERIFYONLY<br />Allows the restore sequence to continue as far as possible…<br />Affected file groups are left in suspect state<br />
  29. 29. Backup/RestoreMirrored Media Sets<br />Redundant backup media helps guarantee successful restore<br />Extra copies for<br />Archival<br />Disaster recovery<br />
  30. 30. Demo<br />
  31. 31. 31<br />Summary<br />Backups are the most important step in restoring your DB in event of failure<br />Maybe your first and last resort<br />Must understand the effects of using them<br />Know ALL the options in handling disaster<br />All the Best !!!<br />
  32. 32. Questions<br />www.<br /><br />T: @vinodk_sql<br />
  33. 33. © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.<br />The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.<br />