SlideShare a Scribd company logo
1 of 14
©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

Kafka elastic search meetup 09242018
Kafka elastic search meetup 09242018Kafka elastic search meetup 09242018
Kafka elastic search meetup 09242018Ying 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 EuropeRicardo 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 kafkaIndrajeet Kumar
 
Oslo Vancouver Project Update
Oslo Vancouver Project UpdateOslo Vancouver Project Update
Oslo Vancouver Project UpdateBen 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, AzulHostedbyConfluent
 
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 ExperienceAPNIC
 
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 Kafkaconfluent
 
OSGi Community Update
OSGi Community UpdateOSGi Community Update
OSGi Community UpdateOSGiUsers
 
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 2020HostedbyConfluent
 
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 RKSGary 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 ClusteringContinuent
 
BlaBlaCar and infrastructure automation
BlaBlaCar and infrastructure automationBlaBlaCar and infrastructure automation
BlaBlaCar and infrastructure automationsinfomicien
 
Ha logical setup
Ha logical setupHa logical setup
Ha logical setupDeepak Mane
 
Introduction to Kafka Cruise Control
Introduction to Kafka Cruise ControlIntroduction to Kafka Cruise Control
Introduction to Kafka Cruise ControlJiangjie 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 ThroughputRichard 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 javaSa_Van
 
delegacion_herencia_polimorfismo
delegacion_herencia_polimorfismodelegacion_herencia_polimorfismo
delegacion_herencia_polimorfismoJohana Añez
 
3 interfaces clases_abstractas_herencia_polimorfismo
3 interfaces clases_abstractas_herencia_polimorfismo3 interfaces clases_abstractas_herencia_polimorfismo
3 interfaces clases_abstractas_herencia_polimorfismoJesus 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 p1Emiliano Andres Abadi
 
Sql server 2012_licensing_reference_guide
Sql server 2012_licensing_reference_guideSql server 2012_licensing_reference_guide
Sql server 2012_licensing_reference_guideamenus006
 
Programación III (Java) - 03 Interfaces
Programación III (Java) - 03 InterfacesProgramación III (Java) - 03 Interfaces
Programación III (Java) - 03 InterfacesAndoni Eguíluz Morán
 
Interface Design Getting Real
Interface Design Getting RealInterface Design Getting Real
Interface Design Getting RealMiguel Rodriguez
 
2016 04 sqlsaturday_transaction_log
2016 04 sqlsaturday_transaction_log2016 04 sqlsaturday_transaction_log
2016 04 sqlsaturday_transaction_logHVR Software
 
Estructuras de datos osvaldo cairo
Estructuras de datos   osvaldo cairoEstructuras de datos   osvaldo cairo
Estructuras de datos osvaldo cairoYossLu 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 PDFKesavan Munuswamy
 
Clases abstractas e interfaces
Clases abstractas e interfacesClases abstractas e interfaces
Clases abstractas e interfaceslopezcortes
 
09 Clases Abstractas E Interfaces
09   Clases Abstractas E Interfaces09   Clases Abstractas E Interfaces
09 Clases Abstractas E InterfacesNetwork Sens
 
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 referenceU.N.S.C
 
SQL Server Backup and Restore
SQL Server Backup and RestoreSQL Server Backup and Restore
SQL Server Backup and RestoreKesavan 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 logsRed Gate Software
 
Backing Up and Recovery
Backing Up and RecoveryBacking Up and Recovery
Backing Up and RecoveryMaham Huda
 
SQLBits XIV - The Big Backup Theory
SQLBits XIV - The Big Backup TheorySQLBits XIV - The Big Backup Theory
SQLBits XIV - The Big Backup TheoryRichard Douglas
 
How minimalloggingcanhelpme bartoszratajczyk_sql_sat534
How minimalloggingcanhelpme bartoszratajczyk_sql_sat534How minimalloggingcanhelpme bartoszratajczyk_sql_sat534
How minimalloggingcanhelpme bartoszratajczyk_sql_sat534Bartosz Ratajczyk
 
Microsoft SQL Server Log Management
Microsoft SQL Server Log ManagementMicrosoft SQL Server Log Management
Microsoft SQL Server Log ManagementStephan Lawson
 
Redo and Rollback
Redo and RollbackRedo and Rollback
Redo and RollbackTubaahin10
 
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 dataAleks 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 LockingIDERA Software
 
DB2 Accounting Reporting
DB2  Accounting ReportingDB2  Accounting Reporting
DB2 Accounting ReportingJohn Campbell
 
Persistence Is Futile - Implementing Delayed Durability
Persistence Is Futile - Implementing Delayed DurabilityPersistence Is Futile - Implementing Delayed Durability
Persistence Is Futile - Implementing Delayed DurabilityMark Broadbent
 
Sql server tips from the field
Sql server tips from the fieldSql server tips from the field
Sql server tips from the fieldJoAnna Cheshire
 
Lesson 3 backup
Lesson 3   backupLesson 3   backup
Lesson 3 backupRam 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 ProcessingMark Broadbent
 
Data guard logical_r3.1
Data guard logical_r3.1Data guard logical_r3.1
Data guard logical_r3.1Ram Naani
 
Less09 managing undo data
Less09 managing undo dataLess09 managing undo data
Less09 managing undo dataImran Ali
 

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

art integrated project of computer applications
art integrated project of computer applicationsart integrated project of computer applications
art integrated project of computer applicationsmarvelpwian65
 
ServiceNow CIS-Discovery Exam Dumps 2024
ServiceNow CIS-Discovery Exam Dumps 2024ServiceNow CIS-Discovery Exam Dumps 2024
ServiceNow CIS-Discovery Exam Dumps 2024SkillCertProExams
 
ACM CHT Best Inspection Practices Kinben Innovation MIC Slideshare.pdf
ACM CHT Best Inspection Practices Kinben Innovation MIC Slideshare.pdfACM CHT Best Inspection Practices Kinben Innovation MIC Slideshare.pdf
ACM CHT Best Inspection Practices Kinben Innovation MIC Slideshare.pdfKinben Innovation Private Limited
 
The Influence and Evolution of Mogul Press in Contemporary Public Relations.docx
The Influence and Evolution of Mogul Press in Contemporary Public Relations.docxThe Influence and Evolution of Mogul Press in Contemporary Public Relations.docx
The Influence and Evolution of Mogul Press in Contemporary Public Relations.docxMogul Press
 
Oracle Database Administration I (1Z0-082) Exam Dumps 2024.pdf
Oracle Database Administration I (1Z0-082) Exam Dumps 2024.pdfOracle Database Administration I (1Z0-082) Exam Dumps 2024.pdf
Oracle Database Administration I (1Z0-082) Exam Dumps 2024.pdfSkillCertProExams
 
OC Streetcar Final Presentation-Downtown Santa Ana
OC Streetcar Final Presentation-Downtown Santa AnaOC Streetcar Final Presentation-Downtown Santa Ana
OC Streetcar Final Presentation-Downtown Santa AnaRahsaan L. Browne
 
Cymulate (Breach and Attack Simulation).
Cymulate (Breach and Attack Simulation).Cymulate (Breach and Attack Simulation).
Cymulate (Breach and Attack Simulation).luckyk1575
 
DAY 0 8 A Revelation 05-19-2024 PPT.pptx
DAY 0 8 A Revelation 05-19-2024 PPT.pptxDAY 0 8 A Revelation 05-19-2024 PPT.pptx
DAY 0 8 A Revelation 05-19-2024 PPT.pptxFamilyWorshipCenterD
 
Breathing in New Life_ Part 3 05 22 2024.pptx
Breathing in New Life_ Part 3 05 22 2024.pptxBreathing in New Life_ Part 3 05 22 2024.pptx
Breathing in New Life_ Part 3 05 22 2024.pptxFamilyWorshipCenterD
 
Understanding Poverty: A Community Questionnaire
Understanding Poverty: A Community QuestionnaireUnderstanding Poverty: A Community Questionnaire
Understanding Poverty: A Community Questionnairebazilnaeem7
 
05232024 Joint Meeting - Community Networking
05232024 Joint Meeting - Community Networking05232024 Joint Meeting - Community Networking
05232024 Joint Meeting - Community NetworkingMichael Orias
 
Deciding The Topic of our Magazine.pptx.
Deciding The Topic of our Magazine.pptx.Deciding The Topic of our Magazine.pptx.
Deciding The Topic of our Magazine.pptx.bazilnaeem7
 

Recently uploaded (12)

art integrated project of computer applications
art integrated project of computer applicationsart integrated project of computer applications
art integrated project of computer applications
 
ServiceNow CIS-Discovery Exam Dumps 2024
ServiceNow CIS-Discovery Exam Dumps 2024ServiceNow CIS-Discovery Exam Dumps 2024
ServiceNow CIS-Discovery Exam Dumps 2024
 
ACM CHT Best Inspection Practices Kinben Innovation MIC Slideshare.pdf
ACM CHT Best Inspection Practices Kinben Innovation MIC Slideshare.pdfACM CHT Best Inspection Practices Kinben Innovation MIC Slideshare.pdf
ACM CHT Best Inspection Practices Kinben Innovation MIC Slideshare.pdf
 
The Influence and Evolution of Mogul Press in Contemporary Public Relations.docx
The Influence and Evolution of Mogul Press in Contemporary Public Relations.docxThe Influence and Evolution of Mogul Press in Contemporary Public Relations.docx
The Influence and Evolution of Mogul Press in Contemporary Public Relations.docx
 
Oracle Database Administration I (1Z0-082) Exam Dumps 2024.pdf
Oracle Database Administration I (1Z0-082) Exam Dumps 2024.pdfOracle Database Administration I (1Z0-082) Exam Dumps 2024.pdf
Oracle Database Administration I (1Z0-082) Exam Dumps 2024.pdf
 
OC Streetcar Final Presentation-Downtown Santa Ana
OC Streetcar Final Presentation-Downtown Santa AnaOC Streetcar Final Presentation-Downtown Santa Ana
OC Streetcar Final Presentation-Downtown Santa Ana
 
Cymulate (Breach and Attack Simulation).
Cymulate (Breach and Attack Simulation).Cymulate (Breach and Attack Simulation).
Cymulate (Breach and Attack Simulation).
 
DAY 0 8 A Revelation 05-19-2024 PPT.pptx
DAY 0 8 A Revelation 05-19-2024 PPT.pptxDAY 0 8 A Revelation 05-19-2024 PPT.pptx
DAY 0 8 A Revelation 05-19-2024 PPT.pptx
 
Breathing in New Life_ Part 3 05 22 2024.pptx
Breathing in New Life_ Part 3 05 22 2024.pptxBreathing in New Life_ Part 3 05 22 2024.pptx
Breathing in New Life_ Part 3 05 22 2024.pptx
 
Understanding Poverty: A Community Questionnaire
Understanding Poverty: A Community QuestionnaireUnderstanding Poverty: A Community Questionnaire
Understanding Poverty: A Community Questionnaire
 
05232024 Joint Meeting - Community Networking
05232024 Joint Meeting - Community Networking05232024 Joint Meeting - Community Networking
05232024 Joint Meeting - Community Networking
 
Deciding The Topic of our Magazine.pptx.
Deciding The Topic of our Magazine.pptx.Deciding The Topic of our Magazine.pptx.
Deciding The Topic of our Magazine.pptx.
 

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)