Presentation is loading. Please wait.

Presentation is loading. Please wait.

Backup and Restore your SQL Server Database

Similar presentations


Presentation on theme: "Backup and Restore your SQL Server Database"— Presentation transcript:

1 Backup and Restore your SQL Server Database
The most important part of the job!

2 Corruption User error Malicious activity Disaster recovery
Why do we back up? Corruption User error Malicious activity Disaster recovery

3 How do we recover a database that is borked?
Restore from the last known good backup. - Microsoft

4 How do we know if the last known backup is good?
Test. Your. Backups. - Basically every data professional

5 The business makes the rules
Recovery Point Objective (RPO) Recovery Time Objective (RTO) Service Level Agreement (SLA)

6 Recovery point objective (RPO)
How much data are we prepared to lose?

7 Recovery time objective (RPO)
How much time do we have to recover?

8 Defining a restore strategy, redux
How much data can we lose? (RPO) How long will recovery take? (RTO) Can we actually do this? (SLA)

9 How do we back up our databases?
Copy database files File snapshots Database snapshots Built-in BACKUP command SQL native backup

10 What is the one true backup method?
SQL Server native backup (the built-in BACKUP command)

11 Corollary to the one true backup method
A SQL Server native backup is only as good as its restore (the built-in RESTORE command)

12 What does a SQL Server data file look like?
Lots of 8KB data pages All objects are stored in pages Each page has a header 8 contiguous pages = extent

13 What does a SQL Server transaction log look like?
Virtual log files Log Sequence Numbers Active / inactive Circular Recovery model etutorials.org

14 So what is a recovery model then?
Full recovery model Bulk-logged recovery model Simple recovery model

15 All transactions are fully logged The log file grows until cleared
Full recovery model All transactions are fully logged The log file grows until cleared Transaction log backups needed Allows point-in-time recovery

16 Bulk-logged recovery model
Bulk operations minimally logged The log file grows until cleared Transaction log backups needed Some point-in-time recovery

17 Log file cleared after every commit No transaction logging at all
Simple recovery model Log file cleared after every commit No transaction logging at all No point-in-time recovery possible

18 What types of backups can I take?
Full backup Differential backup Transaction log backup File / filegroup backup* Partial backup*

19 Full backup (BACKUP DATABASE)
Copy of entire data file Active portion of the log Full, bulk-logged, simple

20 Full backup (BACKUP DATABASE WITH COPY_ONLY)
Copy of entire data file Active portion of the log Does not affect differentials Full, bulk-logged, simple

21 Extents changed since last full Active portion of the log
Differential backup Extents changed since last full Active portion of the log Each differential is bigger Not affected by COPY_ONLY Full, bulk-logged, simple

22 Transaction log backup
Active portion of the log Full and bulk-logged only

23 Log backups are incremental Differential backups are not
Backup chain Log backups are incremental Differential backups are not

24 Restore a full backup (can include a COPY_ONLY backup)

25 Restore to a point in time (basic method)
Restore a full backup (may include a COPY_ONLY backup) Restore all transaction logs Use WITH NORECOVERY option

26 Restore to a point in time with differential backups
Restore a full backup* Restore latest differential backup Restore all transaction logs Use WITH NORECOVERY option

27 Automation is the new black
Automate your backups ola.hallengren.com / dbatools.io / minionware.net / ** SQL Agent ** Notify on failure, not success Automate your restore script Steve Stedman (bit.ly/automateScript)

28 Copy backups securely off-premises Test restores frequently
Best practices Back up with CHECKSUM Copy backups securely off-premises Test restores frequently DBCC CHECKDB is your friend Automate all the things

29 SQL Server Maintenance Wizard Do use:
Tips and tricks Don’t use: SQL Server Maintenance Wizard Do use: Ola Hallengren’s Maintenance Solution MinionWare Backup

30 Show Me The Money imgflip.com


Download ppt "Backup and Restore your SQL Server Database"

Similar presentations


Ads by Google