Crash Recovery
Crash Recovery
Log 3: Transaction is completed. The log indicates the end of the transaction.
Log: <Tn COMMIT>
Database Recovery
Two approaches using logs
◦Deferred database modification
◦Immediate database modification
Database Recovery
Deferred database modification
◦ It ensures transaction atomicity by recording all database modification in the
log but deferring the execution of all write operations of a transaction until the
transaction partially commits.
◦ When a transaction partially commits the information on the log associated
with the transaction is used in executing the deferred writes.
◦ If the system crashes before the transaction completes its execution, then the
information on the log is simply ignored.
◦ Transaction starts by writing <Ti , start> record to log.
◦ A write(X) operation results in a log record <Ti, X, V> being written where V is
the new value of X. here old value is not needed.
Database Recovery
Deferred database modification
• Deferred Update Steps:
• ‘write’ operation is not performed on X at this time but is deferred.
• When Ti partially commits <Ti , commit> is written to log.
• Finally, the log records are read and used to actually execute the
previously deferred writes.
• Redo only scheme:
• During recovery after crash, a transaction needs to be redone if and only if
both <Ti, start> and <Ti , commit> are there in log.
• Redoing a transactionTi (redo(Ti)) sets the value of all data items
updated by the transaction to the new values.
• Crashes can occur while the transaction is executing the original updates or
while recovery action is being taken.
Deferred database modification
◦E.g. Transaction T0 and T1 such that T0 executes before T1.
T1 T2 T3 T4
Commit
START
COMMIT
START
COMMIT
START
FAILURE
Database Recovery
Checkpoint
Table of transactions operations and the lists they are placed in
Operations List
Disk
Shadow Page Current
Page 1 (Original) Page
1 1
4
2 2
3 (modified)
3 3
2
4 4
5
5 5
1 (modified)
3 (Original)
3. Data Backup/Recovery
• Is to protect data.
• Backup files can protect against accidental loss of data, database
corruption and other failures.
• Backup tapes are stored in secured location.
• With backup and recovery plan, we can easily recover our important data
from any type of disasters.
3. Data Backup/Recovery
• To create backup plan, deal with following
• How important is data on your system?
• What type of information does the data contain?
• How often does the data change?
• How quickly do you need to recover the data?
• Do you have equipment to perform backup?
• Who will be responsible for backup and recovery plan?
• What is best time to schedule backup?
3. Data Backup/Recovery • Common backup solutions
• Backup plan depends on factors like • Tape drive
• Capacity • Digital audio tape (DAT) drives
• Reliability • Disk drives
• Extensibility • Magnetic optical drive
• Speed • Auto loader tape systems
• Cost • Removable disks
Remote Backup / Online Backup
• Here files, folders or entire contents of hard drive are regularly backed up
on a remote server with n/w connection.
• Here risk of catastrophic data loss as a result of fire, theft, file corruption
or other disaster is eliminated.
• Encryption and password protection system helps to ensure privacy and
security.
• For large organization and for practically valuable data, online backup
strategy is wise investment.
• In database, it is backup performed on data even though it is actively
accessible to users and may currently be in state of being updated.
• Cloud computing, remote login method are for remote backup and
recovery.
9.4 Remote Backup System
• Remote Backup / Online Backup
• Remote Backup / Online Backup
• Catastrophic failure is one where stable , secondary storage device get corrupted.
To recover from catastrophic failure
• Remote backup
• Backup taken to magnetic tapes and stored in safer place.
Remot
Local e
Database Server