SlideShare a Scribd company logo
©2011 Hewlett-Packard Development Company, L.P.
The information contained herein is subject to change without
notice
Recovery, Logging and
the Transaction Log
Miroslav Dimitrov
Agenda
• Transaction Log Architecture
• Log Records
• Checkpoints
• Transaction Log operations
• Recovery and Crash Recovery
• Recovery Models and Minimal Logging
Transaction Log Architecture
• Creating and growing the log file
• Log is always zero-initialized
• TF 3004 and 3605
• VLFs, Log blocks and LSNs
• Undocumented DBCC LOGINFO
• DBCC SQLPERF (Logspace)
Log Records
• What are they?
• Where they stayed?
• Are they all part of transactions?
• TVF fn_dblog (startLSN,endLSN) – TF 2537
• Compensation records (rollback) – only roll
forward
Conundrum
If a full backup is being taken, then you have
transaction updated 100 000 records but it is rolled
back why is the diff backup so large? Surely
nothing has changed.
Checkpoints
• Why they exists?
• Thresholds 20 ms and 100 ms?!
• Log records during checkpoint
• Log records are written to disk via three ways:
– When we have commit/rollbacked transaction
– When a data file page is written to disk
– When a log block hits the maximum of 60 kb size and
must be flushed to disk
Checkpoints (cont.)
• Types:
– Automatic
– Indirect (new in SQL 2012)
– Internal
– Manual
• TF 3502 (for which db), 3504 (write latency), 3605
• XE Events - checkpoint_begin and
checkpoint_end
Transaction Log operations
• VLF is either active or inactive
• DBCC OPENTRAN
• VLF is made inactive by log clearing (truncation)
• Circular nature of log
• log_reuse_wait_desc in sys.databases – why log
clearing did not succeed last time it was
attempted
Recovery and Crash Recovery
• Recovery brings db to a consistent point in time
• Types:
– Crash recovery after a system failure
– Recovery at the end of restore
– Recovery after a failover (CL, AG, Mirroring)
• REDO
• UNDO
Recovery and Crash Recovery (cont.)
• Recovery during restore
• Crash Recovery
• Where the crash recovery stops?!
• How SQL is recovering DBs? – TF 3408 single
thread
• Fast Recovery (from SQL 2005 onwards – only
ENT) – does not apply for restore
Recovery Models and Minimal Logging
• Minimal Logged vs Efficiently Logged
• FULL
• SIMPLE
• BULK-LOGGED (why to use it only temp)
• Minimally Logged:
– Creating, Dropping, Rebuilding indexes (reorganize is
always fully logged)
– Bulk operations – bcp, bulk insert etc.
Recovery Models and Minimal Logging
(cont.)
• pseudoSimple recovery model?
• Is switching between FULL and BULK-LOGGED
breaking the log backup chain?
• Deferred drop and TRUNCATE table (two ways)
Questions?
Demo time

More Related Content

What's hot

Samuel Bercovici - lbaaS for Havana
Samuel Bercovici - lbaaS for HavanaSamuel Bercovici - lbaaS for Havana
Samuel Bercovici - lbaaS for Havana
Cloud Native Day Tel Aviv
 
Kafka elastic search meetup 09242018
Kafka elastic search meetup 09242018Kafka elastic search meetup 09242018
Kafka elastic search meetup 09242018
Ying Xu
 
How Criteo is managing one of the largest Kafka Infrastructure in Europe
How Criteo is managing one of the largest Kafka Infrastructure in EuropeHow Criteo is managing one of the largest Kafka Infrastructure in Europe
How Criteo is managing one of the largest Kafka Infrastructure in Europe
Ricardo Paiva
 
Discover Kafka on OpenShift: Processing Real-Time Financial Events at Scale (...
Discover Kafka on OpenShift: Processing Real-Time Financial Events at Scale (...Discover Kafka on OpenShift: Processing Real-Time Financial Events at Scale (...
Discover Kafka on OpenShift: Processing Real-Time Financial Events at Scale (...
confluent
 
Autonomous workload rebalancing in kafka
Autonomous workload rebalancing in kafkaAutonomous workload rebalancing in kafka
Autonomous workload rebalancing in kafka
Indrajeet Kumar
 
Oslo Vancouver Project Update
Oslo Vancouver Project UpdateOslo Vancouver Project Update
Oslo Vancouver Project Update
Ben Nemec
 
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, AzulBetter Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
HostedbyConfluent
 
ICANN DNS Symposium (IDS 2019): RDAP CDN Distribution Experience
ICANN DNS Symposium (IDS 2019): RDAP CDN Distribution ExperienceICANN DNS Symposium (IDS 2019): RDAP CDN Distribution Experience
ICANN DNS Symposium (IDS 2019): RDAP CDN Distribution Experience
APNIC
 
Kafka Summit NYC 2017 - Introducing Exactly Once Semantics in Apache Kafka
Kafka Summit NYC 2017 - Introducing Exactly Once Semantics in Apache KafkaKafka Summit NYC 2017 - Introducing Exactly Once Semantics in Apache Kafka
Kafka Summit NYC 2017 - Introducing Exactly Once Semantics in Apache Kafka
confluent
 
OSGi Community Update
OSGi Community UpdateOSGi Community Update
OSGi Community Update
OSGiUsers
 
The Log of All Logs: Raft-based Consensus Inside Kafka | Guozhang Wang, Confl...
The Log of All Logs: Raft-based Consensus Inside Kafka | Guozhang Wang, Confl...The Log of All Logs: Raft-based Consensus Inside Kafka | Guozhang Wang, Confl...
The Log of All Logs: Raft-based Consensus Inside Kafka | Guozhang Wang, Confl...
HostedbyConfluent
 
Keeping Latency Low and Throughput High with Application-level Priority Manag...
Keeping Latency Low and Throughput High with Application-level Priority Manag...Keeping Latency Low and Throughput High with Application-level Priority Manag...
Keeping Latency Low and Throughput High with Application-level Priority Manag...
ScyllaDB
 
Can Kafka Handle a Lyft Ride? (Andrey Falko & Can Cecen, Lyft) Kafka Summit 2020
Can Kafka Handle a Lyft Ride? (Andrey Falko & Can Cecen, Lyft) Kafka Summit 2020Can Kafka Handle a Lyft Ride? (Andrey Falko & Can Cecen, Lyft) Kafka Summit 2020
Can Kafka Handle a Lyft Ride? (Andrey Falko & Can Cecen, Lyft) Kafka Summit 2020
HostedbyConfluent
 
Asynchronous Transaction Processing With Kafka as a Single Source of Truth - ...
Asynchronous Transaction Processing With Kafka as a Single Source of Truth - ...Asynchronous Transaction Processing With Kafka as a Single Source of Truth - ...
Asynchronous Transaction Processing With Kafka as a Single Source of Truth - ...
HostedbyConfluent
 
SAP Rolling Kernel Switch RKS
SAP Rolling Kernel Switch RKSSAP Rolling Kernel Switch RKS
SAP Rolling Kernel Switch RKS
Gary Jackson MBCS
 
Flink Forward Berlin 2017: Andreas Kunft - Efficiently executing R Dataframes...
Flink Forward Berlin 2017: Andreas Kunft - Efficiently executing R Dataframes...Flink Forward Berlin 2017: Andreas Kunft - Efficiently executing R Dataframes...
Flink Forward Berlin 2017: Andreas Kunft - Efficiently executing R Dataframes...
Flink Forward
 
Webinar Slides: MySQL Native Replication vs. Tungsten Clustering
Webinar Slides: MySQL Native Replication vs. Tungsten ClusteringWebinar Slides: MySQL Native Replication vs. Tungsten Clustering
Webinar Slides: MySQL Native Replication vs. Tungsten Clustering
Continuent
 
BlaBlaCar and infrastructure automation
BlaBlaCar and infrastructure automationBlaBlaCar and infrastructure automation
BlaBlaCar and infrastructure automation
sinfomicien
 
Ha logical setup
Ha logical setupHa logical setup
Ha logical setup
Deepak Mane
 
Introduction to Kafka Cruise Control
Introduction to Kafka Cruise ControlIntroduction to Kafka Cruise Control
Introduction to Kafka Cruise Control
Jiangjie Qin
 

What's hot (20)

Samuel Bercovici - lbaaS for Havana
Samuel Bercovici - lbaaS for HavanaSamuel Bercovici - lbaaS for Havana
Samuel Bercovici - lbaaS for Havana
 
Kafka elastic search meetup 09242018
Kafka elastic search meetup 09242018Kafka elastic search meetup 09242018
Kafka elastic search meetup 09242018
 
How Criteo is managing one of the largest Kafka Infrastructure in Europe
How Criteo is managing one of the largest Kafka Infrastructure in EuropeHow Criteo is managing one of the largest Kafka Infrastructure in Europe
How Criteo is managing one of the largest Kafka Infrastructure in Europe
 
Discover Kafka on OpenShift: Processing Real-Time Financial Events at Scale (...
Discover Kafka on OpenShift: Processing Real-Time Financial Events at Scale (...Discover Kafka on OpenShift: Processing Real-Time Financial Events at Scale (...
Discover Kafka on OpenShift: Processing Real-Time Financial Events at Scale (...
 
Autonomous workload rebalancing in kafka
Autonomous workload rebalancing in kafkaAutonomous workload rebalancing in kafka
Autonomous workload rebalancing in kafka
 
Oslo Vancouver Project Update
Oslo Vancouver Project UpdateOslo Vancouver Project Update
Oslo Vancouver Project Update
 
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, AzulBetter Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
 
ICANN DNS Symposium (IDS 2019): RDAP CDN Distribution Experience
ICANN DNS Symposium (IDS 2019): RDAP CDN Distribution ExperienceICANN DNS Symposium (IDS 2019): RDAP CDN Distribution Experience
ICANN DNS Symposium (IDS 2019): RDAP CDN Distribution Experience
 
Kafka Summit NYC 2017 - Introducing Exactly Once Semantics in Apache Kafka
Kafka Summit NYC 2017 - Introducing Exactly Once Semantics in Apache KafkaKafka Summit NYC 2017 - Introducing Exactly Once Semantics in Apache Kafka
Kafka Summit NYC 2017 - Introducing Exactly Once Semantics in Apache Kafka
 
OSGi Community Update
OSGi Community UpdateOSGi Community Update
OSGi Community Update
 
The Log of All Logs: Raft-based Consensus Inside Kafka | Guozhang Wang, Confl...
The Log of All Logs: Raft-based Consensus Inside Kafka | Guozhang Wang, Confl...The Log of All Logs: Raft-based Consensus Inside Kafka | Guozhang Wang, Confl...
The Log of All Logs: Raft-based Consensus Inside Kafka | Guozhang Wang, Confl...
 
Keeping Latency Low and Throughput High with Application-level Priority Manag...
Keeping Latency Low and Throughput High with Application-level Priority Manag...Keeping Latency Low and Throughput High with Application-level Priority Manag...
Keeping Latency Low and Throughput High with Application-level Priority Manag...
 
Can Kafka Handle a Lyft Ride? (Andrey Falko & Can Cecen, Lyft) Kafka Summit 2020
Can Kafka Handle a Lyft Ride? (Andrey Falko & Can Cecen, Lyft) Kafka Summit 2020Can Kafka Handle a Lyft Ride? (Andrey Falko & Can Cecen, Lyft) Kafka Summit 2020
Can Kafka Handle a Lyft Ride? (Andrey Falko & Can Cecen, Lyft) Kafka Summit 2020
 
Asynchronous Transaction Processing With Kafka as a Single Source of Truth - ...
Asynchronous Transaction Processing With Kafka as a Single Source of Truth - ...Asynchronous Transaction Processing With Kafka as a Single Source of Truth - ...
Asynchronous Transaction Processing With Kafka as a Single Source of Truth - ...
 
SAP Rolling Kernel Switch RKS
SAP Rolling Kernel Switch RKSSAP Rolling Kernel Switch RKS
SAP Rolling Kernel Switch RKS
 
Flink Forward Berlin 2017: Andreas Kunft - Efficiently executing R Dataframes...
Flink Forward Berlin 2017: Andreas Kunft - Efficiently executing R Dataframes...Flink Forward Berlin 2017: Andreas Kunft - Efficiently executing R Dataframes...
Flink Forward Berlin 2017: Andreas Kunft - Efficiently executing R Dataframes...
 
Webinar Slides: MySQL Native Replication vs. Tungsten Clustering
Webinar Slides: MySQL Native Replication vs. Tungsten ClusteringWebinar Slides: MySQL Native Replication vs. Tungsten Clustering
Webinar Slides: MySQL Native Replication vs. Tungsten Clustering
 
BlaBlaCar and infrastructure automation
BlaBlaCar and infrastructure automationBlaBlaCar and infrastructure automation
BlaBlaCar and infrastructure automation
 
Ha logical setup
Ha logical setupHa logical setup
Ha logical setup
 
Introduction to Kafka Cruise Control
Introduction to Kafka Cruise ControlIntroduction to Kafka Cruise Control
Introduction to Kafka Cruise Control
 

Viewers also liked

Understanding the Transaction Log, Your Key to Unlocking Greater Throughput
Understanding the Transaction Log, Your Key to Unlocking Greater ThroughputUnderstanding the Transaction Log, Your Key to Unlocking Greater Throughput
Understanding the Transaction Log, Your Key to Unlocking Greater Throughput
Richard Douglas
 
Mcts self paced training kit exam 432 sql server 2008 - implementation and ...
Mcts self paced training kit exam 432   sql server 2008 - implementation and ...Mcts self paced training kit exam 432   sql server 2008 - implementation and ...
Mcts self paced training kit exam 432 sql server 2008 - implementation and ...
Portal_do_Estudante_SQL
 
Polimorfismo en java
Polimorfismo en javaPolimorfismo en java
Polimorfismo en java
Sa_Van
 
delegacion_herencia_polimorfismo
delegacion_herencia_polimorfismodelegacion_herencia_polimorfismo
delegacion_herencia_polimorfismo
Johana Añez
 
3 interfaces clases_abstractas_herencia_polimorfismo
3 interfaces clases_abstractas_herencia_polimorfismo3 interfaces clases_abstractas_herencia_polimorfismo
3 interfaces clases_abstractas_herencia_polimorfismo
Jesus Alberto Iribe Gonzalez
 
Aho hopcroft - estructura de datos y algoritmos p1
Aho   hopcroft - estructura de datos y algoritmos p1Aho   hopcroft - estructura de datos y algoritmos p1
Aho hopcroft - estructura de datos y algoritmos p1
Emiliano Andres Abadi
 
Clases abstractas
Clases abstractasClases abstractas
Clases abstractas
Sebastian Saltos
 
Informes+con+ireport (2)
Informes+con+ireport (2)Informes+con+ireport (2)
Informes+con+ireport (2)
Jhon you are good guy
 
Sql server 2012_licensing_reference_guide
Sql server 2012_licensing_reference_guideSql server 2012_licensing_reference_guide
Sql server 2012_licensing_reference_guide
amenus006
 
Clases abstractas
Clases abstractasClases abstractas
Clases abstractas
Ruben Robles
 
Programación III (Java) - 03 Interfaces
Programación III (Java) - 03 InterfacesProgramación III (Java) - 03 Interfaces
Programación III (Java) - 03 Interfaces
Andoni Eguíluz Morán
 
Interface Design Getting Real
Interface Design Getting RealInterface Design Getting Real
Interface Design Getting Real
Miguel Rodriguez
 
2016 04 sqlsaturday_transaction_log
2016 04 sqlsaturday_transaction_log2016 04 sqlsaturday_transaction_log
2016 04 sqlsaturday_transaction_log
HVR Software
 
Estructuras de datos osvaldo cairo
Estructuras de datos   osvaldo cairoEstructuras de datos   osvaldo cairo
Estructuras de datos osvaldo cairo
YossLu Molina
 
Windows Server 2012 Exam Paper 70-411 PDF
Windows Server 2012 Exam Paper 70-411 PDFWindows Server 2012 Exam Paper 70-411 PDF
Windows Server 2012 Exam Paper 70-411 PDF
Kesavan Munuswamy
 
Clases abstractas e interfaces
Clases abstractas e interfacesClases abstractas e interfaces
Clases abstractas e interfaces
lopezcortes
 
09 Clases Abstractas E Interfaces
09   Clases Abstractas E Interfaces09   Clases Abstractas E Interfaces
09 Clases Abstractas E Interfaces
Network Sens
 
MCSA Exam paper 70-412 PDF
MCSA Exam paper 70-412 PDFMCSA Exam paper 70-412 PDF
MCSA Exam paper 70-412 PDF
Kesavan Munuswamy
 
Sql server 2012 transact sql dml reference
Sql server 2012 transact sql dml referenceSql server 2012 transact sql dml reference
Sql server 2012 transact sql dml reference
U.N.S.C
 
SQL Server Backup and Restore
SQL Server Backup and RestoreSQL Server Backup and Restore
SQL Server Backup and Restore
Kesavan Munuswamy
 

Viewers also liked (20)

Understanding the Transaction Log, Your Key to Unlocking Greater Throughput
Understanding the Transaction Log, Your Key to Unlocking Greater ThroughputUnderstanding the Transaction Log, Your Key to Unlocking Greater Throughput
Understanding the Transaction Log, Your Key to Unlocking Greater Throughput
 
Mcts self paced training kit exam 432 sql server 2008 - implementation and ...
Mcts self paced training kit exam 432   sql server 2008 - implementation and ...Mcts self paced training kit exam 432   sql server 2008 - implementation and ...
Mcts self paced training kit exam 432 sql server 2008 - implementation and ...
 
Polimorfismo en java
Polimorfismo en javaPolimorfismo en java
Polimorfismo en java
 
delegacion_herencia_polimorfismo
delegacion_herencia_polimorfismodelegacion_herencia_polimorfismo
delegacion_herencia_polimorfismo
 
3 interfaces clases_abstractas_herencia_polimorfismo
3 interfaces clases_abstractas_herencia_polimorfismo3 interfaces clases_abstractas_herencia_polimorfismo
3 interfaces clases_abstractas_herencia_polimorfismo
 
Aho hopcroft - estructura de datos y algoritmos p1
Aho   hopcroft - estructura de datos y algoritmos p1Aho   hopcroft - estructura de datos y algoritmos p1
Aho hopcroft - estructura de datos y algoritmos p1
 
Clases abstractas
Clases abstractasClases abstractas
Clases abstractas
 
Informes+con+ireport (2)
Informes+con+ireport (2)Informes+con+ireport (2)
Informes+con+ireport (2)
 
Sql server 2012_licensing_reference_guide
Sql server 2012_licensing_reference_guideSql server 2012_licensing_reference_guide
Sql server 2012_licensing_reference_guide
 
Clases abstractas
Clases abstractasClases abstractas
Clases abstractas
 
Programación III (Java) - 03 Interfaces
Programación III (Java) - 03 InterfacesProgramación III (Java) - 03 Interfaces
Programación III (Java) - 03 Interfaces
 
Interface Design Getting Real
Interface Design Getting RealInterface Design Getting Real
Interface Design Getting Real
 
2016 04 sqlsaturday_transaction_log
2016 04 sqlsaturday_transaction_log2016 04 sqlsaturday_transaction_log
2016 04 sqlsaturday_transaction_log
 
Estructuras de datos osvaldo cairo
Estructuras de datos   osvaldo cairoEstructuras de datos   osvaldo cairo
Estructuras de datos osvaldo cairo
 
Windows Server 2012 Exam Paper 70-411 PDF
Windows Server 2012 Exam Paper 70-411 PDFWindows Server 2012 Exam Paper 70-411 PDF
Windows Server 2012 Exam Paper 70-411 PDF
 
Clases abstractas e interfaces
Clases abstractas e interfacesClases abstractas e interfaces
Clases abstractas e interfaces
 
09 Clases Abstractas E Interfaces
09   Clases Abstractas E Interfaces09   Clases Abstractas E Interfaces
09 Clases Abstractas E Interfaces
 
MCSA Exam paper 70-412 PDF
MCSA Exam paper 70-412 PDFMCSA Exam paper 70-412 PDF
MCSA Exam paper 70-412 PDF
 
Sql server 2012 transact sql dml reference
Sql server 2012 transact sql dml referenceSql server 2012 transact sql dml reference
Sql server 2012 transact sql dml reference
 
SQL Server Backup and Restore
SQL Server Backup and RestoreSQL Server Backup and Restore
SQL Server Backup and Restore
 

Similar to Recovery, logging and the transaction log

Understanding and controlling transaction logs
Understanding and controlling transaction logsUnderstanding and controlling transaction logs
Understanding and controlling transaction logs
Red Gate Software
 
Recovery
RecoveryRecovery
Recovery
Ram Sekhar
 
Backing Up and Recovery
Backing Up and RecoveryBacking Up and Recovery
Backing Up and Recovery
Maham Huda
 
Imetal
ImetalImetal
SQLBits XIV - The Big Backup Theory
SQLBits XIV - The Big Backup TheorySQLBits XIV - The Big Backup Theory
SQLBits XIV - The Big Backup Theory
Richard Douglas
 
How minimalloggingcanhelpme bartoszratajczyk_sql_sat534
How minimalloggingcanhelpme bartoszratajczyk_sql_sat534How minimalloggingcanhelpme bartoszratajczyk_sql_sat534
How minimalloggingcanhelpme bartoszratajczyk_sql_sat534
Bartosz Ratajczyk
 
Microsoft SQL Server Log Management
Microsoft SQL Server Log ManagementMicrosoft SQL Server Log Management
Microsoft SQL Server Log Management
Stephan Lawson
 
Redo and Rollback
Redo and RollbackRedo and Rollback
Redo and Rollback
Tubaahin10
 
Unit 07 dbms
Unit 07 dbmsUnit 07 dbms
Unit 07 dbms
anuragmbst
 
Veeam backup Oracle DB in a VM is easy and reliable way to protect data
Veeam backup Oracle DB in a VM is easy and reliable way to protect dataVeeam backup Oracle DB in a VM is easy and reliable way to protect data
Veeam backup Oracle DB in a VM is easy and reliable way to protect data
Aleks Y
 
Geek Sync | How to Detect, Analyze, and Minimize SQL Server Blocking and Locking
Geek Sync | How to Detect, Analyze, and Minimize SQL Server Blocking and LockingGeek Sync | How to Detect, Analyze, and Minimize SQL Server Blocking and Locking
Geek Sync | How to Detect, Analyze, and Minimize SQL Server Blocking and Locking
IDERA Software
 
DB2 Accounting Reporting
DB2  Accounting ReportingDB2  Accounting Reporting
DB2 Accounting Reporting
John Campbell
 
DBMS UNIT 5 CHAPTER 3.ppt
DBMS UNIT 5 CHAPTER 3.pptDBMS UNIT 5 CHAPTER 3.ppt
DBMS UNIT 5 CHAPTER 3.ppt
HemakanisiriA3124
 
Persistence Is Futile - Implementing Delayed Durability
Persistence Is Futile - Implementing Delayed DurabilityPersistence Is Futile - Implementing Delayed Durability
Persistence Is Futile - Implementing Delayed Durability
Mark Broadbent
 
Sql server tips from the field
Sql server tips from the fieldSql server tips from the field
Sql server tips from the field
JoAnna Cheshire
 
Lesson 3 backup
Lesson 3   backupLesson 3   backup
Lesson 3 backup
Ram Kedem
 
Lockless in Seattle - Using In-Memory OLTP for Transaction Processing
Lockless in Seattle -  Using In-Memory OLTP for Transaction ProcessingLockless in Seattle -  Using In-Memory OLTP for Transaction Processing
Lockless in Seattle - Using In-Memory OLTP for Transaction Processing
Mark Broadbent
 
Data guard logical_r3.1
Data guard logical_r3.1Data guard logical_r3.1
Data guard logical_r3.1
Ram Naani
 
Less09 managing undo data
Less09 managing undo dataLess09 managing undo data
Less09 managing undo data
Imran Ali
 
Sql plsql online training
Sql plsql online trainingSql plsql online training
Sql plsql online training
enrollmy training
 

Similar to Recovery, logging and the transaction log (20)

Understanding and controlling transaction logs
Understanding and controlling transaction logsUnderstanding and controlling transaction logs
Understanding and controlling transaction logs
 
Recovery
RecoveryRecovery
Recovery
 
Backing Up and Recovery
Backing Up and RecoveryBacking Up and Recovery
Backing Up and Recovery
 
Imetal
ImetalImetal
Imetal
 
SQLBits XIV - The Big Backup Theory
SQLBits XIV - The Big Backup TheorySQLBits XIV - The Big Backup Theory
SQLBits XIV - The Big Backup Theory
 
How minimalloggingcanhelpme bartoszratajczyk_sql_sat534
How minimalloggingcanhelpme bartoszratajczyk_sql_sat534How minimalloggingcanhelpme bartoszratajczyk_sql_sat534
How minimalloggingcanhelpme bartoszratajczyk_sql_sat534
 
Microsoft SQL Server Log Management
Microsoft SQL Server Log ManagementMicrosoft SQL Server Log Management
Microsoft SQL Server Log Management
 
Redo and Rollback
Redo and RollbackRedo and Rollback
Redo and Rollback
 
Unit 07 dbms
Unit 07 dbmsUnit 07 dbms
Unit 07 dbms
 
Veeam backup Oracle DB in a VM is easy and reliable way to protect data
Veeam backup Oracle DB in a VM is easy and reliable way to protect dataVeeam backup Oracle DB in a VM is easy and reliable way to protect data
Veeam backup Oracle DB in a VM is easy and reliable way to protect data
 
Geek Sync | How to Detect, Analyze, and Minimize SQL Server Blocking and Locking
Geek Sync | How to Detect, Analyze, and Minimize SQL Server Blocking and LockingGeek Sync | How to Detect, Analyze, and Minimize SQL Server Blocking and Locking
Geek Sync | How to Detect, Analyze, and Minimize SQL Server Blocking and Locking
 
DB2 Accounting Reporting
DB2  Accounting ReportingDB2  Accounting Reporting
DB2 Accounting Reporting
 
DBMS UNIT 5 CHAPTER 3.ppt
DBMS UNIT 5 CHAPTER 3.pptDBMS UNIT 5 CHAPTER 3.ppt
DBMS UNIT 5 CHAPTER 3.ppt
 
Persistence Is Futile - Implementing Delayed Durability
Persistence Is Futile - Implementing Delayed DurabilityPersistence Is Futile - Implementing Delayed Durability
Persistence Is Futile - Implementing Delayed Durability
 
Sql server tips from the field
Sql server tips from the fieldSql server tips from the field
Sql server tips from the field
 
Lesson 3 backup
Lesson 3   backupLesson 3   backup
Lesson 3 backup
 
Lockless in Seattle - Using In-Memory OLTP for Transaction Processing
Lockless in Seattle -  Using In-Memory OLTP for Transaction ProcessingLockless in Seattle -  Using In-Memory OLTP for Transaction Processing
Lockless in Seattle - Using In-Memory OLTP for Transaction Processing
 
Data guard logical_r3.1
Data guard logical_r3.1Data guard logical_r3.1
Data guard logical_r3.1
 
Less09 managing undo data
Less09 managing undo dataLess09 managing undo data
Less09 managing undo data
 
Sql plsql online training
Sql plsql online trainingSql plsql online training
Sql plsql online training
 

Recently uploaded

Carrer goals.pptx and their importance in real life
Carrer goals.pptx  and their importance in real lifeCarrer goals.pptx  and their importance in real life
Carrer goals.pptx and their importance in real life
artemacademy2
 
Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...
Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...
Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...
Suzanne Lagerweij
 
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussionArtificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
OECD Directorate for Financial and Enterprise Affairs
 
The remarkable life of Sir Mokshagundam Visvesvaraya.pptx
The remarkable life of Sir Mokshagundam Visvesvaraya.pptxThe remarkable life of Sir Mokshagundam Visvesvaraya.pptx
The remarkable life of Sir Mokshagundam Visvesvaraya.pptx
JiteshKumarChoudhary2
 
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
 
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
OECD Directorate for Financial and Enterprise Affairs
 
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
OECD Directorate for Financial and Enterprise Affairs
 
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussionPro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
OECD Directorate for Financial and Enterprise Affairs
 
Disaster Management project for holidays homework and other uses
Disaster Management project for holidays homework and other usesDisaster Management project for holidays homework and other uses
Disaster Management project for holidays homework and other uses
RIDHIMAGARG21
 
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
gpww3sf4
 
Competition and Regulation in Professions and Occupations – ROBSON – June 202...
Competition and Regulation in Professions and Occupations – ROBSON – June 202...Competition and Regulation in Professions and Occupations – ROBSON – June 202...
Competition and Regulation in Professions and Occupations – ROBSON – June 202...
OECD Directorate for Financial and Enterprise Affairs
 
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdfWhy Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
Ben Linders
 
怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样
怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样
怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样
kekzed
 
XP 2024 presentation: A New Look to Leadership
XP 2024 presentation: A New Look to LeadershipXP 2024 presentation: A New Look to Leadership
XP 2024 presentation: A New Look to Leadership
samililja
 
Using-Presentation-Software-to-the-Fullf.pptx
Using-Presentation-Software-to-the-Fullf.pptxUsing-Presentation-Software-to-the-Fullf.pptx
Using-Presentation-Software-to-the-Fullf.pptx
kainatfatyma9
 
ASONAM2023_presection_slide_track-recommendation.pdf
ASONAM2023_presection_slide_track-recommendation.pdfASONAM2023_presection_slide_track-recommendation.pdf
ASONAM2023_presection_slide_track-recommendation.pdf
ToshihiroIto4
 
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussionArtificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
OECD Directorate for Financial and Enterprise Affairs
 
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
OECD Directorate for Financial and Enterprise Affairs
 
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussion
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussionPro-competitive Industrial Policy – LANE – June 2024 OECD discussion
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussion
OECD Directorate for Financial and Enterprise Affairs
 
IEEE CIS Webinar Sustainable futures.pdf
IEEE CIS Webinar Sustainable futures.pdfIEEE CIS Webinar Sustainable futures.pdf
IEEE CIS Webinar Sustainable futures.pdf
Claudio Gallicchio
 

Recently uploaded (20)

Carrer goals.pptx and their importance in real life
Carrer goals.pptx  and their importance in real lifeCarrer goals.pptx  and their importance in real life
Carrer goals.pptx and their importance in real life
 
Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...
Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...
Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...
 
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussionArtificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
 
The remarkable life of Sir Mokshagundam Visvesvaraya.pptx
The remarkable life of Sir Mokshagundam Visvesvaraya.pptxThe remarkable life of Sir Mokshagundam Visvesvaraya.pptx
The remarkable life of Sir Mokshagundam Visvesvaraya.pptx
 
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
 
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
 
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
 
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussionPro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
 
Disaster Management project for holidays homework and other uses
Disaster Management project for holidays homework and other usesDisaster Management project for holidays homework and other uses
Disaster Management project for holidays homework and other uses
 
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
 
Competition and Regulation in Professions and Occupations – ROBSON – June 202...
Competition and Regulation in Professions and Occupations – ROBSON – June 202...Competition and Regulation in Professions and Occupations – ROBSON – June 202...
Competition and Regulation in Professions and Occupations – ROBSON – June 202...
 
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdfWhy Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
 
怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样
怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样
怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样
 
XP 2024 presentation: A New Look to Leadership
XP 2024 presentation: A New Look to LeadershipXP 2024 presentation: A New Look to Leadership
XP 2024 presentation: A New Look to Leadership
 
Using-Presentation-Software-to-the-Fullf.pptx
Using-Presentation-Software-to-the-Fullf.pptxUsing-Presentation-Software-to-the-Fullf.pptx
Using-Presentation-Software-to-the-Fullf.pptx
 
ASONAM2023_presection_slide_track-recommendation.pdf
ASONAM2023_presection_slide_track-recommendation.pdfASONAM2023_presection_slide_track-recommendation.pdf
ASONAM2023_presection_slide_track-recommendation.pdf
 
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussionArtificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
 
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
 
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussion
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussionPro-competitive Industrial Policy – LANE – June 2024 OECD discussion
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussion
 
IEEE CIS Webinar Sustainable futures.pdf
IEEE CIS Webinar Sustainable futures.pdfIEEE CIS Webinar Sustainable futures.pdf
IEEE CIS Webinar Sustainable futures.pdf
 

Recovery, logging and the transaction log

  • 1. ©2011 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice Recovery, Logging and the Transaction Log Miroslav Dimitrov
  • 2. Agenda • Transaction Log Architecture • Log Records • Checkpoints • Transaction Log operations • Recovery and Crash Recovery • Recovery Models and Minimal Logging
  • 3. Transaction Log Architecture • Creating and growing the log file • Log is always zero-initialized • TF 3004 and 3605 • VLFs, Log blocks and LSNs • Undocumented DBCC LOGINFO • DBCC SQLPERF (Logspace)
  • 4. Log Records • What are they? • Where they stayed? • Are they all part of transactions? • TVF fn_dblog (startLSN,endLSN) – TF 2537 • Compensation records (rollback) – only roll forward
  • 5. Conundrum If a full backup is being taken, then you have transaction updated 100 000 records but it is rolled back why is the diff backup so large? Surely nothing has changed.
  • 6. Checkpoints • Why they exists? • Thresholds 20 ms and 100 ms?! • Log records during checkpoint • Log records are written to disk via three ways: – When we have commit/rollbacked transaction – When a data file page is written to disk – When a log block hits the maximum of 60 kb size and must be flushed to disk
  • 7. Checkpoints (cont.) • Types: – Automatic – Indirect (new in SQL 2012) – Internal – Manual • TF 3502 (for which db), 3504 (write latency), 3605 • XE Events - checkpoint_begin and checkpoint_end
  • 8. Transaction Log operations • VLF is either active or inactive • DBCC OPENTRAN • VLF is made inactive by log clearing (truncation) • Circular nature of log • log_reuse_wait_desc in sys.databases – why log clearing did not succeed last time it was attempted
  • 9. Recovery and Crash Recovery • Recovery brings db to a consistent point in time • Types: – Crash recovery after a system failure – Recovery at the end of restore – Recovery after a failover (CL, AG, Mirroring) • REDO • UNDO
  • 10. Recovery and Crash Recovery (cont.) • Recovery during restore • Crash Recovery • Where the crash recovery stops?! • How SQL is recovering DBs? – TF 3408 single thread • Fast Recovery (from SQL 2005 onwards – only ENT) – does not apply for restore
  • 11. Recovery Models and Minimal Logging • Minimal Logged vs Efficiently Logged • FULL • SIMPLE • BULK-LOGGED (why to use it only temp) • Minimally Logged: – Creating, Dropping, Rebuilding indexes (reorganize is always fully logged) – Bulk operations – bcp, bulk insert etc.
  • 12. Recovery Models and Minimal Logging (cont.) • pseudoSimple recovery model? • Is switching between FULL and BULK-LOGGED breaking the log backup chain? • Deferred drop and TRUNCATE table (two ways)