0% found this document useful (0 votes)
10 views20 pages

Cp.4 Crash Recovery

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views20 pages

Cp.4 Crash Recovery

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Ch.

4 Crash
PL/PGSQL
Recovery
Crash Recovery

 Crash :-- A crash is the sudden failure of a software application or


operating system or of a hardware device such as a hard disk.

 Crash recovery is the process by which the database is moved


back to a consistent and usable state. This is done by rolling back
incomplete transactions and completing committed transactions
that were still in memory when the crash occurred.
Failure Classification

1, Transaction Failure:
• There are two types of errors that may lead to transactlon fallure.
They are:
1) System Error: The system has entered an undesirable state as a
result of which a transaction cannot continue with its normal
execution.

2) Logical Error :- The transaction can no longer continue with its


normal execution, owing the some internal condition, such as data
not found, bad input or resource limit overflow exceeded.
Failure Classification

2. System Crash:
There is a hardware bug or error In the database software or the
operating system that causes the loss of the content of volatile
storage and leads transaction processing to a halt. The content of
non-volatile storage remains undamaged and is not corrupted.
, Disk Failure:
disk failures disk block losses its content as a result of either a
head failure during a data transfer operation. Copies of the data on
other disks on tertiary media, such as tapes, disks etc., are used to
recover from the failure,
Crash Recovery

Crash recovery is the process by which the database is moved back to a consistent
and usable state. This is done by rolling back incomplete transactions and
completing committed transactions that were still in memory when the crash
occurred

Recovery Concept using checkpoint


The recovery system reads the logs backwards from the end to the last checkpoint.
It maintains two lists, an undo-list and a redo-list. If the recovery system sees a log
with <Tn, Start> and <Tn, Commit> or just <Tn, Commit>, it puts the transaction in
the redo-list.
Log based recovery (Deferred and
Immediate update)
Log-based recovery in DBMS provides the ability to maintain or recover data in case of system
failure. DBMS keeps a record of every transaction on some stable storage device to provide easy
access to data when the system fails. A log file will be created for every operation performed on
the database at that point.
There are two techniques for using log to achieve the recovery:
1. The deferred database modification technigue ensures transaction atomicity by recording all
database modifications in the log. but deferring (delaying) the execution of all write operations
of transaction until the transaction partially commits.
Z. The immediate database modification techniơue allows database modifications to be output
to the database while the transaction is still in the active state. Data modifications written by
active transactions are called uncommitted modifications. If a failure occurs during execution,
the system must use the old value field of log records.
Concept of Log
Log is a structure used to store the database modiflcatlons. It is a sequence of log records
and is maintains a record of all the update activities in the database.
There are several types of log records to record significant events during transaction
processing.
1. Start of Transaction (<start> Log Record): It contains information about the start of each
transaction. It is denoted as: <T; start>.
2. Update Log (<update> Log Record): IIt describes a single database write and it is denoted
as

3. Transaction commit (<commit> Log Record): It records to log when T successfully


commits.
It is denoted as: <T commit>.
Transaction abort (<abort> Log Record): It records to log if T aborts. It is denoted as: <T,
abort>,
To recover from a failure in database, basically two
operations namely

undo and redo


The undo operation reverses (rolls back) the changes made to the
database by an uncommitted transaction and restores the database to
the consistent state that existed before the start of transaction.

The redo operation reapplies the changes of a committed transaction


and restores the database the consistent state it would be at the end of
the transaction. The redo operation is required when the changes of a
committed transaction are not or partially reflected to the database on
disk.
checkpoints

A checkpoint is a process that saves the current state of the


database to disk. This includes all transactions that have been
committed, as well as any changes that have been made to the
database but not yet committed.
The checkpoint is used to declare a point before which the
DBMS was in the consistent state, and all transactions were
committed.
realtionship between database
manager and buffer cache
 A database buffer is a temporary storage area in the main
memory. It allows storing the data temporarily when moving from
one place to another. A database buffer stores a copy of disk
blocks. But, the version of block copies on the disk may be older
than the version in the buffer.

 A Buffer Manager is responsible for allocating space to the buffer


in order to store data into the buffer.
A COMMIT statement is used to save the changes on the current
transaction is permanent.
Syntax

Commit;

A Rollback statement is used to undo all the changes made on the


current transaction.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy