SlideShare a Scribd company logo
1 of 60
1 SQLBits XIV - The Big Backup Theory
I know, I know,
who schedules a 75
minute session on
Backups!?!
In your shoes my
reaction would be…
2 SQLBits XIV - The Big Backup Theory
“Oh what
fresh hell is
this?”
The Dumpling Paradox
S1 E7
The Big Backup Theory
Richard Douglas
6 SQLBits XIV - The Big Backup Theory
The goal of
this
presentation
The Cooper-Hofstadter Polarization - S1 E9
7 SQLBits XIV - The Big Backup Theory
I do work for a vendor,
there may be some
subliminal messages in
this presentation
8 SQLBits XIV - The Big Backup Theory
Don’t have a
“Backup
Strategy”
9 SQLBits XIV - The Big Backup Theory
Agenda
• Why do we need backups?
• Backups available in SQL Server
• Understanding the Transaction Log
• Backup Strategy vs. Restore Strategy
• How to make your backups faster
• How to make your restores faster
10 SQLBits XIV - The Big Backup Theory
Have a
“Restore
Strategy”
11 SQLBits XIV - The Big Backup Theory
If we haven’t met yet…
• Richard Douglas
• Sales Engineer / SQL Evangelist
• SQL Server MCITPro
• SQL User Group Leader
• Blog: http://SQL.RichardDouglas.co.uk
• Twitter: @SQLRich
• Email: Richard.Douglas@Software.Dell.com
• Slides: http://www.Slideshare.net/SQLRich
12 SQLBits XIV - The Big Backup Theory
Seriously,
think about it.
A “Restore
Strategy” makes
so much sense!
13 SQLBits XIV - The Big Backup Theory
This time
Sheldon is
wrong…
Backups are
Essential!
The Cooper-Hofstadter
Polarization S1 E9
14 SQLBits XIV - The Big Backup Theory
Why do we need backups?
• Protect valuable data
• Provides the potential to return to a “point in time”
• Confusion between Disaster Recovery and High Availability
• Backup misconceptions
Image backups are sufficient
Snapshots are sufficient
Differential backups are incremental
System databases only need to be backed up once a week
Only need to keep my last backup
Buffer pool usage
15 SQLBits XIV - The Big Backup Theory
Have a
“Restore
Strategy”
16 SQLBits XIV - The Big Backup Theory
Recovery Models
• Simple
• Full
• Bulk Logged
Data
File
Log
File
SQL
Database
Automated administration Manual Administration
Note: Recovery model will be defaulted to the one in the Model database
17 SQLBits XIV - The Big Backup Theory
Backup Types
• Full
• Differential
• Log
• File / Filegroup
• Tail of the log
• Database Snapshot
18 SQLBits XIV - The Big Backup Theory
Have a
“Restore
Strategy”
20 SQLBits XIV - The Big Backup Theory
Transaction Log Internals
• The Transaction Log is segmented into pieces called
Virtual Log Files (VLF’s)
• There will always be at least one “active” VLF
• The number of VLF’s is determined by the size at creation / growth time.
– Under 64MB 4VLF’s
– >=64 and > 1GB 8 VLF’s
– >= 1GB 16 VLF’s
• But wait, there’s more. VLF’s aren’t the smallest segment of the Transaction
Log …
Active
VLF
Inactive
VLF
Inactive
VLF
Inactive
VLF
Inactive
VLF
21 SQLBits XIV - The Big Backup Theory
Log Blocks
• Each VLF will have a number of “Log Blocks” inside it
• These blocks vary in size:
– Anywhere between 512bytes and 60KB
• A new block is created when:
– The data inside the block hits the 60KB limit
– A commit or abort occurs within a transaction
• Each log block contains a parity bit of 64 or 128 which is flipped every time it
is used.
• Inside each log block we have…
22 SQLBits XIV - The Big Backup Theory
Explaining the
transaction log
is a bit like
nesting dolls
23 SQLBits XIV - The Big Backup Theory
Log Records
• Log records are identified by Log Sequence Numbers or LSN’s
– VLF Sequence nbr : Log block nbr : Log record nbr
• Each data page contains the LSN of the last record that made changes to
that page.
• Log records are written in the order they occur.
i.e. SQL Server will not wait for a transaction to finish before writing away
another concurrent transaction.
• Log records often store before and after images of changes.
• They contain a list of pages that this change has affected.
• Log records are stored in the buffer pool (log cache) until flushed to disk
Look for WAITLOG wait type.
This will become clear when we
cover the restore process
24 SQLBits XIV - The Big Backup Theory
Checkpoint
• Data pages are marked as “dirty” when they are changed.
• The checkpoint process writes all dirty pages to disk and marks them as
cleared.
• Checkpoint is an optimisation process, it reduces the amount of writes to
disk to keep data up to date.
26 SQLBits XIV - The Big Backup Theory
Have a
“Restore
Strategy”
27 SQLBits XIV - The Big Backup Theory
Restore Strategy main considerations
• Time taken to restore data
aka Recovery Time Objective (RTO)
• Data loss acceptability
aka Recovery Point Objective (RPO)
• Cost associated with system
unavailable
Backup Strategy main considerations
• Time taken to perform a backup
• Cost associated with longer
maintenance window
• Cost associated with storing
backup files
Backup Strategy vs Restore Strategy
28 SQLBits XIV - The Big Backup Theory
Showing you
why you need to
have a “Restore
Strategy”
29 SQLBits XIV - The Big Backup Theory
Full backup
0
0
0
1
0
2
0
3
0
4
0
5
0
6
0
7
0
8
0
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
0
0
0
1
0
2
0
3
0
4
0
5
0
6
0
7
0
8
0
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
0
0
0
1
0
2
0
3
0
4
0
5
0
6
0
7
0
8
0
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
0
0
0
1
0
2
0
3
0
4
0
5
0
6
0
7
0
8
0
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
0
0
0
1
0
2
0
3
0
4
0
5
0
6
0
7
0
8
0
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
0
0
0
1
0
2
0
3
0
4
0
5
0
6
0
7
0
8
0
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
0
0
0
1
0
2
0
3
0
4
0
5
0
6
0
7
0
8
0
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
M
T
W
T
F
S
S
30 SQLBits XIV - The Big Backup Theory
Full backup
0
0
0
1
0
2
0
3
0
4
0
5
0
6
0
7
0
8
0
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
0
0
0
1
0
2
0
3
0
4
0
5
0
6
0
7
0
8
0
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
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transaction Log Backup
0
0
0
1
0
2
0
3
0
4
0
5
0
6
0
7
0
8
0
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
0
0
0
1
0
2
0
3
0
4
0
5
0
6
0
7
0
8
0
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
0
0
0
1
0
2
0
3
0
4
0
5
0
6
0
7
0
8
0
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
0
0
0
1
0
2
0
3
0
4
0
5
0
6
0
7
0
8
0
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
0
0
0
1
0
2
0
3
0
4
0
5
0
6
0
7
0
8
0
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
0
0
0
1
0
2
0
3
0
4
0
5
0
6
0
7
0
8
0
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
0
0
0
1
0
2
0
3
0
4
0
5
0
6
0
7
0
8
0
9
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
M
T
W
T
F
S
S
37 SQLBits XIV - The Big Backup Theory
Figured out it’s
safer to have a
“Restore
Strategy” yet?
38 SQLBits XIV - The Big Backup Theory
Optimizing backups
Server
Architecture
Database
Architecture
Backup
Options
39 SQLBits XIV - The Big Backup Theory
Have a
“Restore
Strategy”
40 SQLBits XIV - The Big Backup Theory
Server
Architecture
41 SQLBits XIV - The Big Backup Theory
What
computer do
you have? And
please don’t
say “a white
one”.
The Peanut Reaction – S1 E16
42 SQLBits XIV - The Big Backup Theory
• IO Subsystem
– RAID Levels
– Disk Partition Alignment
– Dedicated drives
• Network cards
– Add more NICs
– Use different subnets
– Use different switches
Optimizing backups – Server Architecture
The DBA team start negotiations
with the Infrastructure team
http://www.flickr.com/photos/jakesutton/859193891/in/photostream
43 SQLBits XIV - The Big Backup Theory
Have a
“Restore
Strategy”
44 SQLBits XIV - The Big Backup Theory
Optimizing backups – Database Architecture
• Table design
– See Natural Born Killers webcast November 2012 (http://dell.to/15RwEtz)
– Blogged at http://bit.ly/GHuUrH
– Space that a table uses is not completely released after you use a DELETE
statement to delete data from the table in SQL Server:
http://support.microsoft.com/kb/913399
• Index Design
– See indexing webcasts October 2012 (http://dell.to/19urm8s)
• File placement
• Compression
45 SQLBits XIV - The Big Backup Theory
End of
subliminal
messages
46 SQLBits XIV - The Big Backup Theory
Actually, I
wouldn’t mind
a caramel
macchiato
47 SQLBits XIV - The Big Backup Theory
Optimizing Backups
• Compression
• BufferCount
• MaxTransferSize
• BlockSize
• Multiple backup devices
Other Backup Options of note
• Init / NoInit
• Format / NoFormat
• Copy Only
• Checksum
• Continue After Error
Backup Options
For a full list of all the backup options refer to Books Online (BOL)
http://msdn.microsoft.com/en-us/library/ms186865.aspx
48 SQLBits XIV - The Big Backup Theory
Backup Options Continued
• Memory used is accessed from outside of the bufferpool
• You can calculate memory usage:
Buffercount * MaxTransferSize
Setting these values too high may cause out of memory conditions
Buffercount calculations for Full / Diff backups:
• 2000
– (NumberofBackupDevices * GetSuggestedIoDepth)
+ NumberofBackupDevices + (DatabaseDeviceCount)
• 2005 and above
– (NumberofBackupDevices * GetSuggestedIoDepth)
+ NumberofBackupDevices + (2*DatabaseDeviceCount)
49 SQLBits XIV - The Big Backup Theory
Calculating BufferCount
• GetSuggestedIODepth
– Disk = 3
– Tape = 3
– VDI = 1 default and 4 max based on device spanning needs http://bit.ly/1i69GUG
• DatabaseDeviceCount = The number distinct drives the database files reside
on.
• I think the formula for 2008+ is wrong. Waiting for CSS to return my email.
The following seems to work:
(NumberofBackupDevices * GetSuggestedIoDepth [4])
+ NumberofBackupDevices + (2*DatabaseDeviceCount)
50 SQLBits XIV - The Big Backup Theory
Demo
51 The Big Backup Theory
Things that
break the log
chain
52 SQLBits XIV - The Big Backup Theory
Restore Problems
• Broken Transaction Log Chain
– Clearing the transaction log (using WITH TRUNCATE ONLY or WITH NO LOG)
– Changing the database to SIMPLE recovery model (checkpoint will clear log))
– Reverting from a database snapshot
– Deleting a log file in the chain
– Backups to NUL devices
53 SQLBits XIV - The Big Backup Theory
Backups
are like
Schrodinger’s
cat
54 SQLBits XIV - The Big Backup Theory
Restore Myths
• Downgrading a backup
• No need to test backups
• Restore time will be the same as the backup time
• Table restores
55 SQLBits XIV - The Big Backup Theory
The Restore Process
A restore operation can have up to four phases:
1. File creation and initialization
2. Data and/or log copy
3. REDO phase of recovery
4. UNDO phase of recovery
56 SQLBits XIV - The Big Backup Theory
The Restore Process
File creation and initialization
• In the beginning there was file creation.
• Then there was the zeroing of the files.
• If the database already exists overwrite using the “WITH REPLACE” clause,
do not drop and restore.
• Use “Instant File Initialization” (IFI) if possible.
Remember the log file still needs to be zeroed out.
• There is a security risk.
• TF 3004 will provide more information about IFI
• TF 1806 will disable IFI
57 SQLBits XIV - The Big Backup Theory
The Restore Process
Data and/or log copy
• In this stage SQL Server:
– Reads the data from the backup file(s)
– Writes the data to the database files
• Having multiple data files and backup files can improve I/O throughput.
• Using native or third party compression reduces the amount of data to be
read (and potentially copied across the network).
Compression vs DeDuplication
• Whilst deduplication does reduce storage costs it will be rehydrated before
copying back across the network and so will not aid the speed of a restore.
58 SQLBits XIV - The Big Backup Theory
The Restore Process
REDO phase of recovery (1)
• The database being recovered has it’s boot page (page 9) checked.
• This page will provide the details of the most recent checkpoint.
• Checkpoint log records are examined to see if there is a list of uncommitted
transactions
• Recovery will start at the oldest uncommitted transaction for the most recent
checkpoint
59 SQLBits XIV - The Big Backup Theory
The Restore Process
REDO phase of recovery (2)
• Each log record is tied to an LSN and contains page numbers of records it has altered
• Each data page’s page header contains the last LSN which made a change to it
• The redo phase compares the two LSN’s
• The redo phase uses something akin to the following formula:
IF PageHeaderLSN < LogRecordLSN
BEGIN
Replay Log Record –Record has not been updated
END
ELSE
DoNothing –Record has this change and possibly some others
60 SQLBits XIV - The Big Backup Theory
The Restore Process
REDO phase of recovery (3)
Finding the end of the log
There are two ways:
1. If the log has not been wrapped then it checks for the occurrence of 512 byte
block full of zeros.
2. If it has been wrapped then it reads through all the active VLF’s in the order of
their sequence number and reads through each log block until it finds one with
the wrong flipped parity bit
61 SQLBits XIV - The Big Backup Theory
The Restore Process
UNDO phase of recovery
• The redo phase keeps track of uncommitted transactions. If there are
uncommitted transactions during recovery then the undo phase kicks in
• As mentioned in the redo section the data page page header contains an
LSN. This is compared to the Log Record LSN
IF PageHeaderLSN >= LogRecordLSN
BEGIN
Undo Log Record –Record requires rollback
Create a “compensation” log record
Update PageHeader LSN with compensation log record LSN
END
63 SQLBits XIV - The Big Backup Theory
Further ways to optimize restores
• Using “Instant File Initialization”
• Using the correct restore strategy
• Server Architecture
• Database Architecture
• Backup compression
• Restore options
– Buffercount
– MaxTransferSize
65 Global MarketingThe Big Backup Theory
Any questions?
Thank you for attending
Richard Douglas
Richard.Douglas@Software.Dell.com
@SQLRich

More Related Content

What's hot

Sql Server 2014 In Memory
Sql Server 2014 In MemorySql Server 2014 In Memory
Sql Server 2014 In MemoryRavi Okade
 
MySQL 5.6 - Operations and Diagnostics Improvements
MySQL 5.6 - Operations and Diagnostics ImprovementsMySQL 5.6 - Operations and Diagnostics Improvements
MySQL 5.6 - Operations and Diagnostics ImprovementsMorgan Tocker
 
Drupal commerce performance profiling and tunning using loadstorm experiments...
Drupal commerce performance profiling and tunning using loadstorm experiments...Drupal commerce performance profiling and tunning using loadstorm experiments...
Drupal commerce performance profiling and tunning using loadstorm experiments...Andy Kucharski
 
MySQL Performance Tuning: Top 10 Tips
MySQL Performance Tuning: Top 10 TipsMySQL Performance Tuning: Top 10 Tips
MySQL Performance Tuning: Top 10 TipsOSSCube
 
KoprowskiT_SQLRelay2014#8_Birmingham_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#8_Birmingham_FromPlanToBackupToCloudKoprowskiT_SQLRelay2014#8_Birmingham_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#8_Birmingham_FromPlanToBackupToCloudTobias Koprowski
 
Upcoming changes in MySQL 5.7
Upcoming changes in MySQL 5.7Upcoming changes in MySQL 5.7
Upcoming changes in MySQL 5.7Morgan Tocker
 
KoprowskiT-Difinify2017-SQL_ServerBackup_In_The_Cloud
KoprowskiT-Difinify2017-SQL_ServerBackup_In_The_CloudKoprowskiT-Difinify2017-SQL_ServerBackup_In_The_Cloud
KoprowskiT-Difinify2017-SQL_ServerBackup_In_The_CloudTobias Koprowski
 
Right-Sizing your SQL Server Virtual Machine
Right-Sizing your SQL Server Virtual MachineRight-Sizing your SQL Server Virtual Machine
Right-Sizing your SQL Server Virtual Machineheraflux
 
Enterprise Drupal Application & Hosting Infrastructure Level Monitoring
Enterprise Drupal Application & Hosting Infrastructure Level MonitoringEnterprise Drupal Application & Hosting Infrastructure Level Monitoring
Enterprise Drupal Application & Hosting Infrastructure Level MonitoringDaniel Kanchev
 
VMworld 2014: Virtualizing Databases
VMworld 2014: Virtualizing DatabasesVMworld 2014: Virtualizing Databases
VMworld 2014: Virtualizing DatabasesVMworld
 
Hardware planning & sizing for sql server
Hardware planning & sizing for sql serverHardware planning & sizing for sql server
Hardware planning & sizing for sql serverDavide Mauri
 
MySQL Performance Metrics that Matter
MySQL Performance Metrics that MatterMySQL Performance Metrics that Matter
MySQL Performance Metrics that MatterMorgan Tocker
 
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...Dave Stokes
 
My sql performance tuning course
My sql performance tuning courseMy sql performance tuning course
My sql performance tuning courseAlberto Centanni
 
Designing enterprise drupal
Designing enterprise drupalDesigning enterprise drupal
Designing enterprise drupalJason Burnett
 
Tips to drive maria db cluster performance for nextcloud
Tips to drive maria db cluster performance for nextcloudTips to drive maria db cluster performance for nextcloud
Tips to drive maria db cluster performance for nextcloudSeveralnines
 
Always on in sql server 2017
Always on in sql server 2017Always on in sql server 2017
Always on in sql server 2017Gianluca Hotz
 
KoprowskiT_SQLRelay2014#1_Reading_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#1_Reading_FromPlanToBackupToCloudKoprowskiT_SQLRelay2014#1_Reading_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#1_Reading_FromPlanToBackupToCloudTobias Koprowski
 
KoprowskiT-Difinify2017-SQL_Security_In_The_Cloud
KoprowskiT-Difinify2017-SQL_Security_In_The_CloudKoprowskiT-Difinify2017-SQL_Security_In_The_Cloud
KoprowskiT-Difinify2017-SQL_Security_In_The_CloudTobias Koprowski
 

What's hot (20)

Sql Server 2014 In Memory
Sql Server 2014 In MemorySql Server 2014 In Memory
Sql Server 2014 In Memory
 
MySQL 5.6 - Operations and Diagnostics Improvements
MySQL 5.6 - Operations and Diagnostics ImprovementsMySQL 5.6 - Operations and Diagnostics Improvements
MySQL 5.6 - Operations and Diagnostics Improvements
 
Drupal commerce performance profiling and tunning using loadstorm experiments...
Drupal commerce performance profiling and tunning using loadstorm experiments...Drupal commerce performance profiling and tunning using loadstorm experiments...
Drupal commerce performance profiling and tunning using loadstorm experiments...
 
MySQL Performance Tuning: Top 10 Tips
MySQL Performance Tuning: Top 10 TipsMySQL Performance Tuning: Top 10 Tips
MySQL Performance Tuning: Top 10 Tips
 
KoprowskiT_SQLRelay2014#8_Birmingham_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#8_Birmingham_FromPlanToBackupToCloudKoprowskiT_SQLRelay2014#8_Birmingham_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#8_Birmingham_FromPlanToBackupToCloud
 
Upcoming changes in MySQL 5.7
Upcoming changes in MySQL 5.7Upcoming changes in MySQL 5.7
Upcoming changes in MySQL 5.7
 
KoprowskiT-Difinify2017-SQL_ServerBackup_In_The_Cloud
KoprowskiT-Difinify2017-SQL_ServerBackup_In_The_CloudKoprowskiT-Difinify2017-SQL_ServerBackup_In_The_Cloud
KoprowskiT-Difinify2017-SQL_ServerBackup_In_The_Cloud
 
Right-Sizing your SQL Server Virtual Machine
Right-Sizing your SQL Server Virtual MachineRight-Sizing your SQL Server Virtual Machine
Right-Sizing your SQL Server Virtual Machine
 
Enterprise Drupal Application & Hosting Infrastructure Level Monitoring
Enterprise Drupal Application & Hosting Infrastructure Level MonitoringEnterprise Drupal Application & Hosting Infrastructure Level Monitoring
Enterprise Drupal Application & Hosting Infrastructure Level Monitoring
 
Drupal In The Cloud
Drupal In The CloudDrupal In The Cloud
Drupal In The Cloud
 
VMworld 2014: Virtualizing Databases
VMworld 2014: Virtualizing DatabasesVMworld 2014: Virtualizing Databases
VMworld 2014: Virtualizing Databases
 
Hardware planning & sizing for sql server
Hardware planning & sizing for sql serverHardware planning & sizing for sql server
Hardware planning & sizing for sql server
 
MySQL Performance Metrics that Matter
MySQL Performance Metrics that MatterMySQL Performance Metrics that Matter
MySQL Performance Metrics that Matter
 
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
 
My sql performance tuning course
My sql performance tuning courseMy sql performance tuning course
My sql performance tuning course
 
Designing enterprise drupal
Designing enterprise drupalDesigning enterprise drupal
Designing enterprise drupal
 
Tips to drive maria db cluster performance for nextcloud
Tips to drive maria db cluster performance for nextcloudTips to drive maria db cluster performance for nextcloud
Tips to drive maria db cluster performance for nextcloud
 
Always on in sql server 2017
Always on in sql server 2017Always on in sql server 2017
Always on in sql server 2017
 
KoprowskiT_SQLRelay2014#1_Reading_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#1_Reading_FromPlanToBackupToCloudKoprowskiT_SQLRelay2014#1_Reading_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#1_Reading_FromPlanToBackupToCloud
 
KoprowskiT-Difinify2017-SQL_Security_In_The_Cloud
KoprowskiT-Difinify2017-SQL_Security_In_The_CloudKoprowskiT-Difinify2017-SQL_Security_In_The_Cloud
KoprowskiT-Difinify2017-SQL_Security_In_The_Cloud
 

Similar to SQLBits XIV - The Big Backup Theory

Sql server tips from the field
Sql server tips from the fieldSql server tips from the field
Sql server tips from the fieldJoAnna Cheshire
 
SQL Server 2017 Enhancements You Need To Know
SQL Server 2017 Enhancements You Need To KnowSQL Server 2017 Enhancements You Need To Know
SQL Server 2017 Enhancements You Need To KnowQuest
 
Backing Up and Recovery
Backing Up and RecoveryBacking Up and Recovery
Backing Up and RecoveryMaham Huda
 
KoprowskiT_SQLSaturdayManchester_2AMaDisasterJustbegan
KoprowskiT_SQLSaturdayManchester_2AMaDisasterJustbeganKoprowskiT_SQLSaturdayManchester_2AMaDisasterJustbegan
KoprowskiT_SQLSaturdayManchester_2AMaDisasterJustbeganTobias Koprowski
 
Liquibase få kontroll på dina databasförändringar
Liquibase   få kontroll på dina databasförändringarLiquibase   få kontroll på dina databasförändringar
Liquibase få kontroll på dina databasförändringarSqueed
 
Sql Server tips from the field
Sql Server tips from the fieldSql Server tips from the field
Sql Server tips from the fieldInnoTech
 
9.6_Course Material-Postgresql_002.pdf
9.6_Course Material-Postgresql_002.pdf9.6_Course Material-Postgresql_002.pdf
9.6_Course Material-Postgresql_002.pdfsreedb2
 
Parkavi_Resume
Parkavi_ResumeParkavi_Resume
Parkavi_ResumeParkavi M
 
Cache issues from T-SQL-generated Plans and How to Manage Them
Cache issues from T-SQL-generated Plans and How to Manage ThemCache issues from T-SQL-generated Plans and How to Manage Them
Cache issues from T-SQL-generated Plans and How to Manage ThemSQLDBApros
 
Kb 40 kevin_klineukug_reading20070717[1]
Kb 40 kevin_klineukug_reading20070717[1]Kb 40 kevin_klineukug_reading20070717[1]
Kb 40 kevin_klineukug_reading20070717[1]shuwutong
 
Oracle Diagnostics : Latches and Enqueues
Oracle Diagnostics : Latches and EnqueuesOracle Diagnostics : Latches and Enqueues
Oracle Diagnostics : Latches and EnqueuesHemant K Chitale
 
I got 99 Problems but my backup ain't one by Richard Douglas
I got 99 Problems but my backup ain't one by Richard DouglasI got 99 Problems but my backup ain't one by Richard Douglas
I got 99 Problems but my backup ain't one by Richard DouglasSQLDBApros
 
DBA 101 : Calling all New Database Administrators (PPT)
DBA 101 : Calling all New Database Administrators (PPT)DBA 101 : Calling all New Database Administrators (PPT)
DBA 101 : Calling all New Database Administrators (PPT)Gustavo Rene Antunez
 
Designing, Building, and Maintaining Large Cubes using Lessons Learned
Designing, Building, and Maintaining Large Cubes using Lessons LearnedDesigning, Building, and Maintaining Large Cubes using Lessons Learned
Designing, Building, and Maintaining Large Cubes using Lessons LearnedDenny Lee
 
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAsOracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAsZohar Elkayam
 
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015 2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015 Geir Høydalsvik
 
24 HOP edición Español - Sql server 2014 backup encryption - Percy Reyes
24 HOP edición Español - Sql server 2014 backup encryption - Percy Reyes24 HOP edición Español - Sql server 2014 backup encryption - Percy Reyes
24 HOP edición Español - Sql server 2014 backup encryption - Percy ReyesSpanishPASSVC
 
Liquibase Integration with MuleSoft
Liquibase Integration with MuleSoftLiquibase Integration with MuleSoft
Liquibase Integration with MuleSoftNeerajKumar1965
 
Oracle DataGuard Online Training in USA | INDIA
Oracle DataGuard Online Training in USA | INDIAOracle DataGuard Online Training in USA | INDIA
Oracle DataGuard Online Training in USA | INDIAXoom Trainings
 

Similar to SQLBits XIV - The Big Backup Theory (20)

Sql server tips from the field
Sql server tips from the fieldSql server tips from the field
Sql server tips from the field
 
SQL Server 2017 Enhancements You Need To Know
SQL Server 2017 Enhancements You Need To KnowSQL Server 2017 Enhancements You Need To Know
SQL Server 2017 Enhancements You Need To Know
 
Backing Up and Recovery
Backing Up and RecoveryBacking Up and Recovery
Backing Up and Recovery
 
KoprowskiT_SQLSaturdayManchester_2AMaDisasterJustbegan
KoprowskiT_SQLSaturdayManchester_2AMaDisasterJustbeganKoprowskiT_SQLSaturdayManchester_2AMaDisasterJustbegan
KoprowskiT_SQLSaturdayManchester_2AMaDisasterJustbegan
 
Liquibase få kontroll på dina databasförändringar
Liquibase   få kontroll på dina databasförändringarLiquibase   få kontroll på dina databasförändringar
Liquibase få kontroll på dina databasförändringar
 
Sql Server tips from the field
Sql Server tips from the fieldSql Server tips from the field
Sql Server tips from the field
 
9.6_Course Material-Postgresql_002.pdf
9.6_Course Material-Postgresql_002.pdf9.6_Course Material-Postgresql_002.pdf
9.6_Course Material-Postgresql_002.pdf
 
Parkavi_Resume
Parkavi_ResumeParkavi_Resume
Parkavi_Resume
 
Cache issues from T-SQL-generated Plans and How to Manage Them
Cache issues from T-SQL-generated Plans and How to Manage ThemCache issues from T-SQL-generated Plans and How to Manage Them
Cache issues from T-SQL-generated Plans and How to Manage Them
 
Kb 40 kevin_klineukug_reading20070717[1]
Kb 40 kevin_klineukug_reading20070717[1]Kb 40 kevin_klineukug_reading20070717[1]
Kb 40 kevin_klineukug_reading20070717[1]
 
Oracle Diagnostics : Latches and Enqueues
Oracle Diagnostics : Latches and EnqueuesOracle Diagnostics : Latches and Enqueues
Oracle Diagnostics : Latches and Enqueues
 
I got 99 Problems but my backup ain't one by Richard Douglas
I got 99 Problems but my backup ain't one by Richard DouglasI got 99 Problems but my backup ain't one by Richard Douglas
I got 99 Problems but my backup ain't one by Richard Douglas
 
DBA 101 : Calling all New Database Administrators (PPT)
DBA 101 : Calling all New Database Administrators (PPT)DBA 101 : Calling all New Database Administrators (PPT)
DBA 101 : Calling all New Database Administrators (PPT)
 
Apouc 2014-enterprise-manager-12c
Apouc 2014-enterprise-manager-12cApouc 2014-enterprise-manager-12c
Apouc 2014-enterprise-manager-12c
 
Designing, Building, and Maintaining Large Cubes using Lessons Learned
Designing, Building, and Maintaining Large Cubes using Lessons LearnedDesigning, Building, and Maintaining Large Cubes using Lessons Learned
Designing, Building, and Maintaining Large Cubes using Lessons Learned
 
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAsOracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
 
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015 2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
 
24 HOP edición Español - Sql server 2014 backup encryption - Percy Reyes
24 HOP edición Español - Sql server 2014 backup encryption - Percy Reyes24 HOP edición Español - Sql server 2014 backup encryption - Percy Reyes
24 HOP edición Español - Sql server 2014 backup encryption - Percy Reyes
 
Liquibase Integration with MuleSoft
Liquibase Integration with MuleSoftLiquibase Integration with MuleSoft
Liquibase Integration with MuleSoft
 
Oracle DataGuard Online Training in USA | INDIA
Oracle DataGuard Online Training in USA | INDIAOracle DataGuard Online Training in USA | INDIA
Oracle DataGuard Online Training in USA | INDIA
 

Recently uploaded

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 

Recently uploaded (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

SQLBits XIV - The Big Backup Theory

  • 1. 1 SQLBits XIV - The Big Backup Theory I know, I know, who schedules a 75 minute session on Backups!?! In your shoes my reaction would be…
  • 2. 2 SQLBits XIV - The Big Backup Theory “Oh what fresh hell is this?” The Dumpling Paradox S1 E7
  • 3. The Big Backup Theory Richard Douglas
  • 4. 6 SQLBits XIV - The Big Backup Theory The goal of this presentation The Cooper-Hofstadter Polarization - S1 E9
  • 5. 7 SQLBits XIV - The Big Backup Theory I do work for a vendor, there may be some subliminal messages in this presentation
  • 6. 8 SQLBits XIV - The Big Backup Theory Don’t have a “Backup Strategy”
  • 7. 9 SQLBits XIV - The Big Backup Theory Agenda • Why do we need backups? • Backups available in SQL Server • Understanding the Transaction Log • Backup Strategy vs. Restore Strategy • How to make your backups faster • How to make your restores faster
  • 8. 10 SQLBits XIV - The Big Backup Theory Have a “Restore Strategy”
  • 9. 11 SQLBits XIV - The Big Backup Theory If we haven’t met yet… • Richard Douglas • Sales Engineer / SQL Evangelist • SQL Server MCITPro • SQL User Group Leader • Blog: http://SQL.RichardDouglas.co.uk • Twitter: @SQLRich • Email: Richard.Douglas@Software.Dell.com • Slides: http://www.Slideshare.net/SQLRich
  • 10. 12 SQLBits XIV - The Big Backup Theory Seriously, think about it. A “Restore Strategy” makes so much sense!
  • 11. 13 SQLBits XIV - The Big Backup Theory This time Sheldon is wrong… Backups are Essential! The Cooper-Hofstadter Polarization S1 E9
  • 12. 14 SQLBits XIV - The Big Backup Theory Why do we need backups? • Protect valuable data • Provides the potential to return to a “point in time” • Confusion between Disaster Recovery and High Availability • Backup misconceptions Image backups are sufficient Snapshots are sufficient Differential backups are incremental System databases only need to be backed up once a week Only need to keep my last backup Buffer pool usage
  • 13. 15 SQLBits XIV - The Big Backup Theory Have a “Restore Strategy”
  • 14. 16 SQLBits XIV - The Big Backup Theory Recovery Models • Simple • Full • Bulk Logged Data File Log File SQL Database Automated administration Manual Administration Note: Recovery model will be defaulted to the one in the Model database
  • 15. 17 SQLBits XIV - The Big Backup Theory Backup Types • Full • Differential • Log • File / Filegroup • Tail of the log • Database Snapshot
  • 16. 18 SQLBits XIV - The Big Backup Theory Have a “Restore Strategy”
  • 17. 20 SQLBits XIV - The Big Backup Theory Transaction Log Internals • The Transaction Log is segmented into pieces called Virtual Log Files (VLF’s) • There will always be at least one “active” VLF • The number of VLF’s is determined by the size at creation / growth time. – Under 64MB 4VLF’s – >=64 and > 1GB 8 VLF’s – >= 1GB 16 VLF’s • But wait, there’s more. VLF’s aren’t the smallest segment of the Transaction Log … Active VLF Inactive VLF Inactive VLF Inactive VLF Inactive VLF
  • 18. 21 SQLBits XIV - The Big Backup Theory Log Blocks • Each VLF will have a number of “Log Blocks” inside it • These blocks vary in size: – Anywhere between 512bytes and 60KB • A new block is created when: – The data inside the block hits the 60KB limit – A commit or abort occurs within a transaction • Each log block contains a parity bit of 64 or 128 which is flipped every time it is used. • Inside each log block we have…
  • 19. 22 SQLBits XIV - The Big Backup Theory Explaining the transaction log is a bit like nesting dolls
  • 20. 23 SQLBits XIV - The Big Backup Theory Log Records • Log records are identified by Log Sequence Numbers or LSN’s – VLF Sequence nbr : Log block nbr : Log record nbr • Each data page contains the LSN of the last record that made changes to that page. • Log records are written in the order they occur. i.e. SQL Server will not wait for a transaction to finish before writing away another concurrent transaction. • Log records often store before and after images of changes. • They contain a list of pages that this change has affected. • Log records are stored in the buffer pool (log cache) until flushed to disk Look for WAITLOG wait type. This will become clear when we cover the restore process
  • 21. 24 SQLBits XIV - The Big Backup Theory Checkpoint • Data pages are marked as “dirty” when they are changed. • The checkpoint process writes all dirty pages to disk and marks them as cleared. • Checkpoint is an optimisation process, it reduces the amount of writes to disk to keep data up to date.
  • 22. 26 SQLBits XIV - The Big Backup Theory Have a “Restore Strategy”
  • 23. 27 SQLBits XIV - The Big Backup Theory Restore Strategy main considerations • Time taken to restore data aka Recovery Time Objective (RTO) • Data loss acceptability aka Recovery Point Objective (RPO) • Cost associated with system unavailable Backup Strategy main considerations • Time taken to perform a backup • Cost associated with longer maintenance window • Cost associated with storing backup files Backup Strategy vs Restore Strategy
  • 24. 28 SQLBits XIV - The Big Backup Theory Showing you why you need to have a “Restore Strategy”
  • 25. 29 SQLBits XIV - The Big Backup Theory Full backup 0 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 2 0 2 1 2 2 2 3 0 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 2 0 2 1 2 2 2 3 0 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8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 1 9 2 0 2 1 2 2 2 3 0 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 2 0 2 1 2 2 2 3 0 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 2 0 2 1 2 2 2 3 0 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 2 0 2 1 2 2 2 3 M T W T F S S
  • 33. 37 SQLBits XIV - The Big Backup Theory Figured out it’s safer to have a “Restore Strategy” yet?
  • 34. 38 SQLBits XIV - The Big Backup Theory Optimizing backups Server Architecture Database Architecture Backup Options
  • 35. 39 SQLBits XIV - The Big Backup Theory Have a “Restore Strategy”
  • 36. 40 SQLBits XIV - The Big Backup Theory Server Architecture
  • 37. 41 SQLBits XIV - The Big Backup Theory What computer do you have? And please don’t say “a white one”. The Peanut Reaction – S1 E16
  • 38. 42 SQLBits XIV - The Big Backup Theory • IO Subsystem – RAID Levels – Disk Partition Alignment – Dedicated drives • Network cards – Add more NICs – Use different subnets – Use different switches Optimizing backups – Server Architecture The DBA team start negotiations with the Infrastructure team http://www.flickr.com/photos/jakesutton/859193891/in/photostream
  • 39. 43 SQLBits XIV - The Big Backup Theory Have a “Restore Strategy”
  • 40. 44 SQLBits XIV - The Big Backup Theory Optimizing backups – Database Architecture • Table design – See Natural Born Killers webcast November 2012 (http://dell.to/15RwEtz) – Blogged at http://bit.ly/GHuUrH – Space that a table uses is not completely released after you use a DELETE statement to delete data from the table in SQL Server: http://support.microsoft.com/kb/913399 • Index Design – See indexing webcasts October 2012 (http://dell.to/19urm8s) • File placement • Compression
  • 41. 45 SQLBits XIV - The Big Backup Theory End of subliminal messages
  • 42. 46 SQLBits XIV - The Big Backup Theory Actually, I wouldn’t mind a caramel macchiato
  • 43. 47 SQLBits XIV - The Big Backup Theory Optimizing Backups • Compression • BufferCount • MaxTransferSize • BlockSize • Multiple backup devices Other Backup Options of note • Init / NoInit • Format / NoFormat • Copy Only • Checksum • Continue After Error Backup Options For a full list of all the backup options refer to Books Online (BOL) http://msdn.microsoft.com/en-us/library/ms186865.aspx
  • 44. 48 SQLBits XIV - The Big Backup Theory Backup Options Continued • Memory used is accessed from outside of the bufferpool • You can calculate memory usage: Buffercount * MaxTransferSize Setting these values too high may cause out of memory conditions Buffercount calculations for Full / Diff backups: • 2000 – (NumberofBackupDevices * GetSuggestedIoDepth) + NumberofBackupDevices + (DatabaseDeviceCount) • 2005 and above – (NumberofBackupDevices * GetSuggestedIoDepth) + NumberofBackupDevices + (2*DatabaseDeviceCount)
  • 45. 49 SQLBits XIV - The Big Backup Theory Calculating BufferCount • GetSuggestedIODepth – Disk = 3 – Tape = 3 – VDI = 1 default and 4 max based on device spanning needs http://bit.ly/1i69GUG • DatabaseDeviceCount = The number distinct drives the database files reside on. • I think the formula for 2008+ is wrong. Waiting for CSS to return my email. The following seems to work: (NumberofBackupDevices * GetSuggestedIoDepth [4]) + NumberofBackupDevices + (2*DatabaseDeviceCount)
  • 46. 50 SQLBits XIV - The Big Backup Theory Demo
  • 47. 51 The Big Backup Theory Things that break the log chain
  • 48. 52 SQLBits XIV - The Big Backup Theory Restore Problems • Broken Transaction Log Chain – Clearing the transaction log (using WITH TRUNCATE ONLY or WITH NO LOG) – Changing the database to SIMPLE recovery model (checkpoint will clear log)) – Reverting from a database snapshot – Deleting a log file in the chain – Backups to NUL devices
  • 49. 53 SQLBits XIV - The Big Backup Theory Backups are like Schrodinger’s cat
  • 50. 54 SQLBits XIV - The Big Backup Theory Restore Myths • Downgrading a backup • No need to test backups • Restore time will be the same as the backup time • Table restores
  • 51. 55 SQLBits XIV - The Big Backup Theory The Restore Process A restore operation can have up to four phases: 1. File creation and initialization 2. Data and/or log copy 3. REDO phase of recovery 4. UNDO phase of recovery
  • 52. 56 SQLBits XIV - The Big Backup Theory The Restore Process File creation and initialization • In the beginning there was file creation. • Then there was the zeroing of the files. • If the database already exists overwrite using the “WITH REPLACE” clause, do not drop and restore. • Use “Instant File Initialization” (IFI) if possible. Remember the log file still needs to be zeroed out. • There is a security risk. • TF 3004 will provide more information about IFI • TF 1806 will disable IFI
  • 53. 57 SQLBits XIV - The Big Backup Theory The Restore Process Data and/or log copy • In this stage SQL Server: – Reads the data from the backup file(s) – Writes the data to the database files • Having multiple data files and backup files can improve I/O throughput. • Using native or third party compression reduces the amount of data to be read (and potentially copied across the network). Compression vs DeDuplication • Whilst deduplication does reduce storage costs it will be rehydrated before copying back across the network and so will not aid the speed of a restore.
  • 54. 58 SQLBits XIV - The Big Backup Theory The Restore Process REDO phase of recovery (1) • The database being recovered has it’s boot page (page 9) checked. • This page will provide the details of the most recent checkpoint. • Checkpoint log records are examined to see if there is a list of uncommitted transactions • Recovery will start at the oldest uncommitted transaction for the most recent checkpoint
  • 55. 59 SQLBits XIV - The Big Backup Theory The Restore Process REDO phase of recovery (2) • Each log record is tied to an LSN and contains page numbers of records it has altered • Each data page’s page header contains the last LSN which made a change to it • The redo phase compares the two LSN’s • The redo phase uses something akin to the following formula: IF PageHeaderLSN < LogRecordLSN BEGIN Replay Log Record –Record has not been updated END ELSE DoNothing –Record has this change and possibly some others
  • 56. 60 SQLBits XIV - The Big Backup Theory The Restore Process REDO phase of recovery (3) Finding the end of the log There are two ways: 1. If the log has not been wrapped then it checks for the occurrence of 512 byte block full of zeros. 2. If it has been wrapped then it reads through all the active VLF’s in the order of their sequence number and reads through each log block until it finds one with the wrong flipped parity bit
  • 57. 61 SQLBits XIV - The Big Backup Theory The Restore Process UNDO phase of recovery • The redo phase keeps track of uncommitted transactions. If there are uncommitted transactions during recovery then the undo phase kicks in • As mentioned in the redo section the data page page header contains an LSN. This is compared to the Log Record LSN IF PageHeaderLSN >= LogRecordLSN BEGIN Undo Log Record –Record requires rollback Create a “compensation” log record Update PageHeader LSN with compensation log record LSN END
  • 58. 63 SQLBits XIV - The Big Backup Theory Further ways to optimize restores • Using “Instant File Initialization” • Using the correct restore strategy • Server Architecture • Database Architecture • Backup compression • Restore options – Buffercount – MaxTransferSize
  • 59. 65 Global MarketingThe Big Backup Theory Any questions?
  • 60. Thank you for attending Richard Douglas Richard.Douglas@Software.Dell.com @SQLRich

Editor's Notes

  1. Single point in time, look at how much data could be lost!
  2. 2 places to restore to. Less data loss
  3. Restore to any point in time up to the last transaction log backup. Data loss is delta between now and the last transaction log backup.
  4. Buffercount – Total number of I/O buffers to be used. MaxTransferSize – Largest unit of transfer size used in bytes BlockSize - The physical block size of the backup
  5. From John Huang’s blog: http://www.sqlnotes.info/2011/10/31/page-type/ Type 1 – Data page. Data records in heap Clustered index leaf-level Location can be random Type 2 – Index page Non-clustered index Non-leave-level clustered index Location can be random Type 3 – Text Mixed Page Small LOB value(s), multiple types and rows. Location can be random Type 4 – Text Page LOB value from a single column value Location can be random Type 7 – Sort Page Temporary page for sort operation. Usually tempdb, but can be in user database for online operations. Location can be random Type 8 – GAM Page Global Allocation Map, track allocation of extents. One bit for each extent, if the bit is 1, means the extent is free, otherwise means the extent is allocated (not necessary full). The first GAM page in each file is page 2 Type 9 – SGAM Page Shared Global Allocation Map, track allocation of shared extents One bit for each extent, if the bit is 1, means the extent is allocated but has free space, otherwise means the extent is full The first SGAM page in each file is page 3 Type 10 – IAM Page Index Allocation Map. Extent allocation in a GAM interval for an index or heap table. Location can be random. Type 11 – PFS Page Page Free Space. Byte map, keeps track of free space of pages The first PFS is page 1 in each file. Type 13 – Boot Page Information about the page Only page 9 in file 1. Type 14 – Server Configuration Page (It may not be the official name) Part of information returned from sp_configure. It only exists in master database, file 1, page 10 SQL Server 2008 Only Type 15 – File Header Page Information about the file. It’s always page 0 every data page. Type 16 – Differential Changed map Extents in GAM interval have changed since last full or differential backup The first Differential Changed Page is page 6 in each file Type 17 – Bulk Change Map Extents in GAM interval modified by bulk operations since last backup The first Bulk Change Map page is page 7 in each file.