Recovery Techniques and Need of Recovery, 3 states of database Recovery:, DBMS Failure , Transaction Failure…, System Crash…, Disk Failure…,LOG BASED , CONCURRENT TRANSACTION, Checkpoint…
3. “Recovery” is the process of restoring the database to
the most recent consistent state that exits just before the
Failure.
Recovery techniques are heavily dependent upon the
existence of a special file known as a system log. It
contains information about the start and end of each
transaction and any updates which occur in
the transaction.
3
4. In computing, data recovery is a process of retrieving
inaccessible, lost, corrupted, damaged or formatted data
from secondary storage, removable media or files, when
the data stored in them cannot be accessed in a normal
way.
The most common data recovery scenario involves an
operating system failure, malfunction of a storage device,
logical failure of storage devices, accidental damage or
deletion, etc.
4
5. After all when data is starting to lost there are some
techniques introduced to retrieve that data back
safely.
There are 3 states of database Recovery:
Pre-Condition:- At any given point in the time the
database is in consistent state.
Condition:- Occurs some kind of system failure.
Post-condition:- Restore the database to the
consistent state that existed before the failure.
Note :-
Before we discuss about Recovery first we need to know about why Recovery is needed ?
It is need because of failure’s.
So we first Understand about failure…
5
6. In Computer terminology “Failure “ is the state when
any process is being “Interrupted” and cant produce
an desired result’s.
In concern with DBMS Failure can be classified by :–
Transaction Failure
System crash
Disk Failure
6
8. The transaction failure occurs when it fails to
execute or when it reaches a point from where it
can't 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 errors: If a transaction cannot complete due to
some code error or an internal error condition, then the
logical error occurs.
◦ Syntax error: It occurs where the DBMS itself terminates
an active transaction because the database system is not
able to execute it. For example, The system aborts an
active transaction, in case of deadlock or resource
unavailability.
8
9. Simply we can say that System failure can occur due
to power failure or other hardware or software
failure.
In computing, a crash, or system crash, occurs
when a computer program such as a software
application or an operating system stops
functioning properly and exits.
9
10. Disk failure occurs due to the formation of bad
sectors, disk head crash, and unreachability to
the disk or any other failure, which destroy all or
part of disk storage.
A hard disk failure may occur in the course of
normal operation, or due to an external factor
such as exposure to fire or water or
high magnetic fields, or suffering a
sharp impact or environmental contamination,
which can lead to a head crash.
10
11. “Recovery” is the process of restoring the database
to the most recent consistent state that exits just
before the Failure.
11
12. There are basically 2 types Recovery
techniques
i.e.
1) LOG BASED
2) CONCURRENT TRANSACTION
12
13. Log is a sequence of records, which maintains
the records of actions performed by a
transaction. In this method LOG of each
transaction is maintain in some Stable
Storage.
In case of any Failure occurs it can be recover
from recover Station.
LOG:- Every log will have an information like
what transaction is being executed , which
value have been modified.
13
14. Write to a log file before writing to database
Enter log records
Transaction states:
Start, Abort, Commit
Example log file
DB(A = 1000,B = 2000)
Transaction Log File
T1 start <T1,Start>
Read(A)
A = A-100
Write(A) <T1,A,1000,900>
T1 end <T1, Commit>
T2 start <T2, Start>
Read(B)
B=B+100
Write(B) <T2, B, 2000, 2100>
T2 end <T2, Commit>
14
15. When more than one transaction are being execute
parallel the LOG, at Recovery time it would become
hard for recovery system to back track all log’s.
So to prevent this situation we use
“CHECKPOINTS”.
These are like Bookmarks , when transaction is
executed such chckpnt are marked on that
transaction.
15
16. Recovery system consults log file when
failure occurs
Search entries in log file
Time depends on number of entries
Why redo transactions already written to
disk?
Introduce checkpoint records into log file
Only transactions committed after last
checkpoint
need to be redone after a failure
16
17. 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.
If the recovery system sees a log with <Tn, Start>
but no commit or abort log found, it puts the
transaction in undo-list.
17
18. From the above Description about the Failure &
Data Recovery techniques we had focus on
Problem i.e the data can be lost for many
reasons
and sometimes the System cant be helpful for
storing data by which many organization can
face
the data lost , lack of information , corrupt data
and many more similar situation’s.
18
19. Recovery is an modern methodology that prevent
user from crucial data loss problem.
There are several techniques that can help and
stop the Failure at there own level.
The Checkpoint is a term that ensure your
progress on data by which in a large dataset the
user can start from last “checkpoint”.
19