Database Management Systems (2130703)

BE | Semester-3   Summer-2018 | 05/23/2018

Q4) (b)

Define transaction. Explain various states of transaction with suitable diagram.

A transaction, in the context of a database, is a logical unit that is independently executed for data retrieval or updates. In relational databases, database transactions must be atomic, consistent, isolated and durable--summarized as the ACID acronym.
  • Because failure of transaction may occur, transaction is broken up into states to handle various situations.
  • Following are the different states in transaction processing in database
    1. Acitve
    2. Partial committed
    3. Failed
    4. Aborted
    5. Committed
States of Transaction
(States of Transaction)

Active

  • This is the initial state. The transaction stay in this state while it is executing.

Partially Committed

  • This is the state after the final statement of the transaction is executed.
  • At this point failure is still possible since changes may have been only done in main memory, a hardware failure could still occur.
  • The DBMS needs to write out enough information to disk so that, in case of a failure, the system could re-create the updates performed by the transaction once the system is brought back up.
  • After it has written out all the necessary information, it is committed.

Failed

  • After the discovery that normal execution can no longer proceed.
  • Once a transaction cannot be completed, any changes that it made must be undone rolling it back.

Aborted

  • The state after the transaction has been rolled back and the database has been restored to its state prior to the start of the transaction.

Committed

  • The transaction enters in this state after successful completion of the transaction.
  • We cannot abort or rollback a committed transaction.