Backup to Basics Tom Fox belvdr@gmail.com
Just who do you think you are? SQL Server MCITP DBA 2008 Oracle 8i through 12c, Linux, Unix, Windows, SAN administration, Networking, Information Security Loved coffee since coffee wasn’t cool Gamer since the Atari 2600 / Commodore 64 Extra class amateur radio operator, KQ8W
I'm not a DBA, but wait... Whose data is it? Who determines criticality? If lost or damaged, who is impacted? Managing data is a team responsibility
I don’t need backups because… I have a RAID set Our disk and/or database is replicated I have high availability Configuration and hardware are no replacements for backups
To backup or not to backup OLTP vs Warehousing User vs System databases Not tempdb
Starting at the basics FULL DIFF TLOG Link to last TLOG backup Begins the chain DIFF Links to last full backup TLOG Link to last TLOG backup
EVER! The Backup Chain Determines how to restore Resembles a road map Must have the entire chain to restore Don’t break the chain EVER!
Full Backup Operation Database checkpoint occurs LSN is recorded Data is read from the data pages After data is read, transaction log is read TLOG backups cannot occur during a full backup Example: 1st Sunday of Month – Full Backup contains LSN 1 to 100
Differential Backup Operation Same as full except… Only contains data that has changed since last full backup Cumulative, not incremental Example: 2nd Sunday of Month Differential – LSN 100 to 200 3rd Sunday of Month Differential – LSN 100 to 300
TLOG Backup Operation Enables point-in-time recovery Contains all records from LSN of last backup Incremental, not cumulative Example TLOG Backup 1am – 2am contains LSN 100 - 106 TLOG Backup 2am – 3am contains LSN 106 - 146 TLOG Backup 3am – 4am contains LSN 146 - 379
The Backup Chain Courtesy of: http://technet.microsoft.com/en-us/magazine/2009.07.sqlbackup.aspx
Recovery Models Simple Full Bulk-Logged 12
Choosing a Recovery Model Recovery Point Objective (RPO) How much data can I lose? Recovery Time Objective (RTO) How quickly can I recover to my RPO?
Quiz Choose any backup sequences that are valid 100MB DB, few transactions per hour, RPO 1 hour, RTO 15 minutes 100MB DB, many transactions per hour, RPO 1 hour, RTO 15 minutes 1TB DB, warehouse loaded nightly, RPO 24 hours, RTO 4 hours
Your backups are not valid if you only... RESTORE VERIFYONLY RESTORE VERIFYONLY … WITH CHECKSUM Only valid test is to restore the database and run DBCC CHECKDB
Get that warm and fuzzy feeling Enable page verification of CHECKSUM Run DBCC CHECKDB Run BACKUP...WITH CHECKSUM Run RESTORE VERIFYONLY...WITH CHECKSUM Perform test restores frequently
Implementation Maintenance Plans Ola Hallengren (ola.hallengren.com) Custom jobs Trace flag 3023 (all versions) SQL 2014 backup checksum default Configure SQL Agent appropriately
Q & A Tom Fox belvdr@gmail.com