by Dinesh Thakur Category: Advanced Database Tech.

In-order to recover the system after these failures we need to identify the failure modes of those devices used for storage of data. Next, we must consider how these failure modes affect the contents of the database. Then we can propose the recovery algorithms to recover the database. Every Recovery algorithm performs two types of actions. These are:

• Actions taken during normal transaction processing to ensure enough information exists to allow recovery from failure.

• Actions taken following a failure to recover the database to a state that is known to be correct.

Terminology Used In Recovery Process

Disk is partitioned into fixed length storage units called blocks. Blocks are the units of data transfer to and from disk and may contain several data. When a transaction starts the data required for the transaction is transferred from the disk to main memory (RAM) in\ blocks. When all the operations are performed on the block present in the main memory, then that block is transferred from main memory to disk for the final storage of results. The blocks residing on the disk one called as physical block. The block residing in temporarily on main memory is referred to as Buffer blocks. The area of memory where block reside temporarily is called as disk buffer as shown.

                       input operation

Block movements between disk and main memory are categorized in to following two operations:

Input Operation: Transfer the physical block to main memory as shown.

Output Operation: Transfer the buffer block in main memory to the disk and replaces the appropriate physical block as shown.

                      output operation

Work Area of a Transaction

Each transaction Ti has a private work area in which copy of all the data items accessed and updated by Ti are kept. This work area is created when the transaction is initiated and is removed when transaction is completed or cancelled. Each data item X kept in work area of transaction is denoted by Xi.

Example:

                                                         Work Area of a Transaction

Read (A, a)

In order to perform above transaction first we find the data block in disk where A resides.

Suppose that data item A resides. in block X. Then system search for block X in main Memory (RAM). If block is not in main memory then system issue the inputs X command it means block X is copied from disk to main memory. After getting the value block X in main memory then the value of A is copied to temporary variable "a". Now "a" has value 1000. All the above operations are covered under single read (A, a) operation.

                                                                     a=a-50

This subtraction is actually performed on local temporary variable "a". Now it has value 950 as shown in figure.

                     Work Area of  Transaction1

Write (A, a)

In order to perform above operation first system check that to which block data item A belongs. It is found that A belongs to block X then block X is searched in main memory. If block X is not in main memory then again input X operation is performed. After getting block X in main memory then content of temporary local variable "a" i.e. 950 is copied to database variable A"-Now database item A has value 950 in main memory. Since whole operation is performed in main memory the result of transaction A=950 are stored in main memory as shown in figure. Then in order to store the result in disk output operation is performed.

                     

Output (X)

In case of output (X) block X residing in main memory overwritten in disk. It mean that now the value of data item A=950 is copied to disk permanently and the result of transaction is stored safely as shown in figure.

                     

If you liked this article, you can also catch us on facebook and Google+

Related Articles (You May Also Like)






About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.