There are several recovery techniques to recover database form failures caused due to system crashes or transaction errors. Recovery of databases from transaction failure done by restoring most consistent state of the respective database before the time of failure, to restore the recent database, system keeps informations on change applied on datas by various transaction .These information are kept in system log.
Recovery can be summarized as:
1.If an extensive damage has occured on wide portion of database due to some catastrophic failures such as disk crash etc, recovery methods replaces the current database with most recent backup copy and reconstructs to near perfect state by redoing some of the commited transaction from system log to the failure time.
2.If database has not physically damaged but inconsitent subjected to noncatastrophic failure,the approach followed is to redo, undo some of the operations which caused the inconsistency
Some of the approaches followed to recover database are
  • Recovery Outline and Categorization of Recovery Algorithms.
  • Caching Contents in Disk Block.
  • Write-Ahead Logging .
  • Implementing CheckPoints.
  • Transaction Rollback.
  • * Recovery Outline and Categorization of Recovery Algorithms :-
    This approach is used to recover data base which is subjected to 2nd type of database failure mentioned above, two techniques to recover database from non catastrophic failure are the
    Cookie cok = new Cookie(“cookie_name”, cookie_value);
    //setting cookie attributes
    cok.setMaxAge(30 * 60);
    cok.setPath(“/path/”);
    cok.setDomain(“.domain.com”);
    cok.setSecure(true)
    //adding cookie to response
    response.addCookie(ck);
    Reading cookies
    In order to read the cookies ,we need to traverse through the cookie list obtained from the request object (since there may be different cookies in same name ,we cannot address cookies by their name)
    1.Deferred update in which the database is saved to disc after the transaction reaches commit point, So if transaction has not reached its commit point it may have changed the db.Hence no UNDO is required and similarly no need for REDO the operations from back up log.Hence this technique is also known NO-UNDO/REDO algorithm.

    2.Immediate Update techniques database state is saved by some operations before transaction reaches commit point hence UNDO/REDO operations have to be performed if database failure occurs hence this technique also known as REDO/UNDO algorithm

    * Caching Contents in Disk Block
    As the name refers the disk pages that have database datas are cached into main memory buffers also known as the DBMS cache, there is director that keep track of the buffered contents.
    * Write-Ahead Logging
    This technique uses WAL write-ahead logging protocol for recover algorithm which requires UNDO/REDO operations in this the old transactions are BIFM(old transactions details) are saved to log which is flushed to disk before AIFM(new transaction details ) replaces BFIM
    * Implementing CheckPoints
    In this technique a checkpoint is written into backup system log periodically when system writes out db to disk,hence in the case of db failure the checkpoints intervals are checked where failure occured the minutes and transistion between the last check point and failure is noted and several operations are performed to get near perfect state of db.

    * Transaction Rollback
    This method involves the roll back of whatever transaction done on the database which may be the cause of inconsistence in the database. Also if another transaction dependent on the previous transaction, it is rolled back first. This process is also called cascading rollback.