0
1.4kviews
Explain log based recovery

Mumbai University > Information Technology > Sem 3 > Database Management System

Marks: 10M

Year: Dec 2013

1 Answer
0
13views

Log Based Recovery

  • The most widely used structure for recording database modification is the log.
  • The log is a sequence of log records, recording all the update activities in the database
  • In short Transaction log is a journal, which contains history of all transaction performed
  • Log contains Start of transaction, trans-id, record-id, type of operation (insert, update, delete), old value, new value, End of transaction that is commit or aborted.

There are several types of log records.

  • Transaction identifier
  • Data-item identifier
  • Old value
  • New value

  • Whenever a transaction performs a write, it is essential that the log record for that write be created before the database is modified.

  • Once a log record exists, we can output the modification that has already been output to the database, by using the old value field in the log records.

Log based recovery works as follows:

  • The log file is kept on stable storage media
  • When a transaction enters the system and starts execution, it writes a log about it

<tn, start=""> - When the transaction modifies an item X, it write logs as follows: <tn, x,="" v1,="" v2="">

It reads Tn has changed the value of X, from V1 to V2.

  • When transaction finishes, it logs:

<tn,commit>

Database can be modified using two approaches:

Deferred database modification: All logs are written on to the stable storage and database is updated when transaction commits.

Immediate database modification: Each log follows an actual database modification.

That is, database is modified immediately after every operation.

Please log in to add an answer.