SlideShare a Scribd company logo
Reasons of
transaction
failure, system
recovery and
media recovery
-Sandhya Devkota
Transaction Failure
→ The transaction failure occurs when it fails to
execute or when it reaches a point from where
it cannot go any further. If a few transaction or
process is hurt, then this is called as
transaction failure.
Reasons for a transaction failure could be:
• Logical error: Transaction cannot complete due
to some internal error condition.
• System errors: The database system must
terminate an active transaction due to an error
condition (e.g., dead lock)
• System Crash
→ It can occur due to power failure or other
hardware/software failure.
Example: Operating system error.
• Disk Failure
→ It occur where hard disk drives or storage device
used to fail frequently. Disk failure occurs due to the
formation of bad sectors, disk crash and
unreachability to the disk or any other failure which
destroy all the part of disk storage.
Recovery
and
Atomicity
Recovery:
→ Recovery is the process of
retrieving data from damaged,
failed or corrupted storage.
Atomicity:
→ Transaction as a whole must be
maintained, that is, either all or
none.
Example: online shopping or ATM.
When a DBMS recovers from a crash, it should maintain the
following:
• It should check the states of all the transactions, which were
being executed.
• A transaction may be in the middle of some operation; the
DBMS must ensure the atomicity of the transaction in this
case.
• It should check whether the transaction can be completed
now or it need to be rolled back.
• No transactions would be allowed to leave the DBMS in an
inconsistent state.
Inconsistent
→ Data Inconsistent means that different files
contain different information of a particular
person or object.
Example:
Consider these two table student and address
table.
- Student table contains ID, Name, Class and
Mobile Number
- Address table contains Address of student, ID,
District and Mobile Number.
In these two tables mobile number column is
same. So, same data in the student table will be
present in address table. Now one student
wants to change his mobile number. The mobile
number in student table is updated. So, there is
inconsistent between these two data. This term
is called data inconsistency.
There are two types of techniques, which can
help a DBMS in recovering as well as
maintaining the atomicity of a transaction.
1) Log-based recovery
→ It assumes that transactions are executed
serially, that means only one transaction is
active at a time. It uses a structure called log to
store the database modification.
2) Shadow paging
→ This is the method where all the transactions
are executed in the primary memory or the
shadow copy of database. Once all the
transactions completely executed, it will be
updated to the database. Hence, if there is any
failure it will not be reflected in the database.
Data base will be updated after all transaction
Log-based Recovery
→ Log is a sequence of record, which maintains the
record of actions performed by a transaction. It is
important that the logs are written prior to the actual
modification and stored on a stable storage media,
which is failsafe.
The database can be modified using two approaches-
• Deferred database modification – All logs are
written on the stable storage and the database is
updated when a transaction commits.
• Immediate database modification – Each log
follows an actual database modification. That is, the
database is modified immediately after every
operation.
Recovery with
Concurrent
Transaction
• → If it is a case of execution of
two or more transactions, the
interleaving of logs will occur.
It will become very
inconvenient for the system of
recovery to backtrack every
record and start the process of
recovering.
• → Most database
management system make
use of the concept of
“checkpoint” to make the
situation more convenient and
more manageable.
CHECKPOINT
→ The checkpoint is a type of mechanism where all the
previous logs are removed from the system and permanently
stored in the storage disk.
→ The checkpoint is like a bookmark. The checkpoint is used
to declare a point before which the DBMS was in the
consistent state, and all transactions were committed.
During transaction executed, such checkpoints are marked,
and after execution, the log files will be created.
When it reaches to the checkpoint, then the transaction will be
updated into the database, and till the point, the entire log
file will be removed from the file. Then the log file is updated
with the new step of transaction till next checkpoint and so
on.
Why do we need checkpoint?
→ Whenever transaction logs are created in a real-
time environment, it eats up lots of storage space.
Also keeping track of every update and its
maintenance may increase the physical space of
the system. Eventually, the transaction log file may
not by handled as the size keeps growing. This can
be addressed with checkpoints.
Advantages of using checkpoints:
• Speeds up data recovery process.
• Prevents unnecessary redo operations.
• Since dirty pages are flushed out continuously in
the background, it has very low overhead and can
be done frequently.
Recovery
→ Recovery is the process of restoring the
database to a correct (consistent) state in the
event of a failure. The failure may be result of
system crash or system error. Recovery
system is used to return the database to the
checkpoint state. The behaviour when the
system crashes and recovers when concurrent
transaction are executed is shown by figure:
Checkpoint Failure
T1
T2
T3
T4
Recovery
• The recovery system reads log file from the end to start. It reads log files
from T4 to T1.
• It maintains two list, a redo-list, and an undo-list.
• The transaction is put into redo state if the recovery system sees a log
with <Tn, Start> and <Tn, Commit> or just <Tn, Commit>. In the redo-list
and their previous list, all the transaction are removed and then redone
before saving their logs.
For example: In the log file, transaction T2 and T3 will have <Tn, Start> and
<Tn, Commit>. The T1 transaction will have only <Tn, Commit> in the log
file. That’s why the transaction is committed after the checkpoint is
crossed. Hence it puts T1, T2 and T3 transaction into redo list.
• Te transaction is put into undo state if the recovery system sees a log
with <Tn, Start> but no commit or abort log found. In the undo-list, all the
transaction are undone, and their logs are removed.
For example: Transaction T4 will have <Tn, Start>. So T4 will be put into
undo list since this transaction is not yet completed and failed amid
THANK YOU
SANDHYA DEVKOTA
(BBA,III SEM)-Presidency College Of
Management Science

More Related Content

What's hot

15. Transactions in DBMS
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMS
koolkampus
 
Transaction concurrency control
Transaction concurrency controlTransaction concurrency control
Transaction concurrency control
Anand Grewal
 
16. Concurrency Control in DBMS
16. Concurrency Control in DBMS16. Concurrency Control in DBMS
16. Concurrency Control in DBMS
koolkampus
 
Database , 12 Reliability
Database , 12 ReliabilityDatabase , 12 Reliability
Database , 12 Reliability
Ali Usman
 
Chapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency controlChapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency control
AbDul ThaYyal
 

What's hot (20)

15. Transactions in DBMS
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMS
 
Transaction concurrency control
Transaction concurrency controlTransaction concurrency control
Transaction concurrency control
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Adbms 35 recoverability and serializability
Adbms 35 recoverability and serializabilityAdbms 35 recoverability and serializability
Adbms 35 recoverability and serializability
 
Database recovery techniques
Database recovery techniquesDatabase recovery techniques
Database recovery techniques
 
Query decomposition in data base
Query decomposition in data baseQuery decomposition in data base
Query decomposition in data base
 
Schedule in DBMS
Schedule in DBMSSchedule in DBMS
Schedule in DBMS
 
Concurrent transactions
Concurrent transactionsConcurrent transactions
Concurrent transactions
 
Distributed database
Distributed databaseDistributed database
Distributed database
 
16. Concurrency Control in DBMS
16. Concurrency Control in DBMS16. Concurrency Control in DBMS
16. Concurrency Control in DBMS
 
Measures of query cost
Measures of query costMeasures of query cost
Measures of query cost
 
Active database
Active databaseActive database
Active database
 
Lock based protocols
Lock based protocolsLock based protocols
Lock based protocols
 
Sql server concurrency
Sql server concurrencySql server concurrency
Sql server concurrency
 
Shadow paging
Shadow pagingShadow paging
Shadow paging
 
Recovery techniques
Recovery techniquesRecovery techniques
Recovery techniques
 
Database , 12 Reliability
Database , 12 ReliabilityDatabase , 12 Reliability
Database , 12 Reliability
 
Chapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency controlChapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency control
 
Transaction processing
Transaction processingTransaction processing
Transaction processing
 
Distributed concurrency control
Distributed concurrency controlDistributed concurrency control
Distributed concurrency control
 

Similar to Dbms

Unit 4 chapter - 8 Transaction processing Concepts (1).pptx
Unit 4 chapter - 8 Transaction processing Concepts (1).pptxUnit 4 chapter - 8 Transaction processing Concepts (1).pptx
Unit 4 chapter - 8 Transaction processing Concepts (1).pptx
Koteswari Kasireddy
 
Databases: Backup and Recovery
Databases: Backup and RecoveryDatabases: Backup and Recovery
Databases: Backup and Recovery
Damian T. Gordon
 
CS 542 -- Failure Recovery, Concurrency Control
CS 542 -- Failure Recovery, Concurrency ControlCS 542 -- Failure Recovery, Concurrency Control
CS 542 -- Failure Recovery, Concurrency Control
J Singh
 
database recovery techniques
database recovery techniques database recovery techniques
database recovery techniques
Kalhan Liyanage
 
DBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptx
DBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptxDBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptx
DBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptx
HemaSenthil5
 

Similar to Dbms (20)

DBMS Vardhaman.pdf
DBMS Vardhaman.pdfDBMS Vardhaman.pdf
DBMS Vardhaman.pdf
 
Introduction to transaction processing concepts and theory
Introduction to transaction processing concepts and theoryIntroduction to transaction processing concepts and theory
Introduction to transaction processing concepts and theory
 
UNIT 4- CRASH AND RECOVERY.pdf
UNIT 4- CRASH AND RECOVERY.pdfUNIT 4- CRASH AND RECOVERY.pdf
UNIT 4- CRASH AND RECOVERY.pdf
 
Tranasaction management
Tranasaction managementTranasaction management
Tranasaction management
 
What is Database Backup? The 3 Important Recovery Techniques from transaction...
What is Database Backup? The 3 Important Recovery Techniques from transaction...What is Database Backup? The 3 Important Recovery Techniques from transaction...
What is Database Backup? The 3 Important Recovery Techniques from transaction...
 
Unit 4 chapter - 8 Transaction processing Concepts (1).pptx
Unit 4 chapter - 8 Transaction processing Concepts (1).pptxUnit 4 chapter - 8 Transaction processing Concepts (1).pptx
Unit 4 chapter - 8 Transaction processing Concepts (1).pptx
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management System
 
Transactionsmanagement
TransactionsmanagementTransactionsmanagement
Transactionsmanagement
 
Databases: Backup and Recovery
Databases: Backup and RecoveryDatabases: Backup and Recovery
Databases: Backup and Recovery
 
DBMS UNIT IV.pptx
DBMS UNIT IV.pptxDBMS UNIT IV.pptx
DBMS UNIT IV.pptx
 
Recovery System.pptx
Recovery System.pptxRecovery System.pptx
Recovery System.pptx
 
Transaction Properties(ACID Properties)
Transaction Properties(ACID Properties)Transaction Properties(ACID Properties)
Transaction Properties(ACID Properties)
 
TRANSACTION MANAGEMENT AND TIME STAMP PROTOCOLS AND BACKUP RECOVERY
TRANSACTION MANAGEMENT AND TIME STAMP PROTOCOLS AND BACKUP RECOVERYTRANSACTION MANAGEMENT AND TIME STAMP PROTOCOLS AND BACKUP RECOVERY
TRANSACTION MANAGEMENT AND TIME STAMP PROTOCOLS AND BACKUP RECOVERY
 
CS 542 -- Failure Recovery, Concurrency Control
CS 542 -- Failure Recovery, Concurrency ControlCS 542 -- Failure Recovery, Concurrency Control
CS 542 -- Failure Recovery, Concurrency Control
 
E-Business Information System BBA AVI.pptx
E-Business Information System BBA AVI.pptxE-Business Information System BBA AVI.pptx
E-Business Information System BBA AVI.pptx
 
Unit 4 dbms
Unit 4 dbmsUnit 4 dbms
Unit 4 dbms
 
database recovery techniques
database recovery techniques database recovery techniques
database recovery techniques
 
2 recovery
2 recovery2 recovery
2 recovery
 
DBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptx
DBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptxDBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptx
DBMS-Recovery techniques dfggrjfchdfhwrshfxbvdgtytdfx.pptx
 
Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch11-recovery-2013
 

Recently uploaded

Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 

Recently uploaded (20)

Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 

Dbms

  • 1. Reasons of transaction failure, system recovery and media recovery -Sandhya Devkota
  • 2. Transaction Failure → The transaction failure occurs when it fails to execute or when it reaches a point from where it cannot go any further. If a few transaction or process is hurt, then this is called as transaction failure. Reasons for a transaction failure could be: • Logical error: Transaction cannot complete due to some internal error condition. • System errors: The database system must terminate an active transaction due to an error condition (e.g., dead lock)
  • 3. • System Crash → It can occur due to power failure or other hardware/software failure. Example: Operating system error. • Disk Failure → It occur where hard disk drives or storage device used to fail frequently. Disk failure occurs due to the formation of bad sectors, disk crash and unreachability to the disk or any other failure which destroy all the part of disk storage.
  • 4. Recovery and Atomicity Recovery: → Recovery is the process of retrieving data from damaged, failed or corrupted storage. Atomicity: → Transaction as a whole must be maintained, that is, either all or none. Example: online shopping or ATM.
  • 5. When a DBMS recovers from a crash, it should maintain the following: • It should check the states of all the transactions, which were being executed. • A transaction may be in the middle of some operation; the DBMS must ensure the atomicity of the transaction in this case. • It should check whether the transaction can be completed now or it need to be rolled back. • No transactions would be allowed to leave the DBMS in an inconsistent state.
  • 6. Inconsistent → Data Inconsistent means that different files contain different information of a particular person or object. Example: Consider these two table student and address table. - Student table contains ID, Name, Class and Mobile Number - Address table contains Address of student, ID, District and Mobile Number. In these two tables mobile number column is same. So, same data in the student table will be present in address table. Now one student wants to change his mobile number. The mobile number in student table is updated. So, there is inconsistent between these two data. This term is called data inconsistency.
  • 7. There are two types of techniques, which can help a DBMS in recovering as well as maintaining the atomicity of a transaction. 1) Log-based recovery → It assumes that transactions are executed serially, that means only one transaction is active at a time. It uses a structure called log to store the database modification. 2) Shadow paging → This is the method where all the transactions are executed in the primary memory or the shadow copy of database. Once all the transactions completely executed, it will be updated to the database. Hence, if there is any failure it will not be reflected in the database. Data base will be updated after all transaction
  • 8. Log-based Recovery → Log is a sequence of record, which maintains the record of actions performed by a transaction. It is important that the logs are written prior to the actual modification and stored on a stable storage media, which is failsafe. The database can be modified using two approaches- • Deferred database modification – All logs are written on the stable storage and the database is updated when a transaction commits. • Immediate database modification – Each log follows an actual database modification. That is, the database is modified immediately after every operation.
  • 9. Recovery with Concurrent Transaction • → If it is a case of execution of two or more transactions, the interleaving of logs will occur. It will become very inconvenient for the system of recovery to backtrack every record and start the process of recovering. • → Most database management system make use of the concept of “checkpoint” to make the situation more convenient and more manageable.
  • 10. CHECKPOINT → The checkpoint is a type of mechanism where all the previous logs are removed from the system and permanently stored in the storage disk. → The checkpoint is like a bookmark. The checkpoint is used to declare a point before which the DBMS was in the consistent state, and all transactions were committed. During transaction executed, such checkpoints are marked, and after execution, the log files will be created. When it reaches to the checkpoint, then the transaction will be updated into the database, and till the point, the entire log file will be removed from the file. Then the log file is updated with the new step of transaction till next checkpoint and so on.
  • 11. Why do we need checkpoint? → Whenever transaction logs are created in a real- time environment, it eats up lots of storage space. Also keeping track of every update and its maintenance may increase the physical space of the system. Eventually, the transaction log file may not by handled as the size keeps growing. This can be addressed with checkpoints. Advantages of using checkpoints: • Speeds up data recovery process. • Prevents unnecessary redo operations. • Since dirty pages are flushed out continuously in the background, it has very low overhead and can be done frequently.
  • 12. Recovery → Recovery is the process of restoring the database to a correct (consistent) state in the event of a failure. The failure may be result of system crash or system error. Recovery system is used to return the database to the checkpoint state. The behaviour when the system crashes and recovers when concurrent transaction are executed is shown by figure: Checkpoint Failure T1 T2 T3 T4
  • 13. Recovery • The recovery system reads log file from the end to start. It reads log files from T4 to T1. • It maintains two list, a redo-list, and an undo-list. • The transaction is put into redo state if the recovery system sees a log with <Tn, Start> and <Tn, Commit> or just <Tn, Commit>. In the redo-list and their previous list, all the transaction are removed and then redone before saving their logs. For example: In the log file, transaction T2 and T3 will have <Tn, Start> and <Tn, Commit>. The T1 transaction will have only <Tn, Commit> in the log file. That’s why the transaction is committed after the checkpoint is crossed. Hence it puts T1, T2 and T3 transaction into redo list. • Te transaction is put into undo state if the recovery system sees a log with <Tn, Start> but no commit or abort log found. In the undo-list, all the transaction are undone, and their logs are removed. For example: Transaction T4 will have <Tn, Start>. So T4 will be put into undo list since this transaction is not yet completed and failed amid
  • 14. THANK YOU SANDHYA DEVKOTA (BBA,III SEM)-Presidency College Of Management Science