What are the states of transaction in DBMS?


A transaction is a unit of database processing which contains a set of operations. For example, deposit of money, balance enquiry, reservation of tickets etc.

Every transaction starts with delimiters begin transaction and terminates with end transaction delimiters. The set of operations within these two delimiters constitute one transaction.

main()
{
   begin transaction
} end transaction

A transaction is divided into states to handle various situations such as failure. It passes through various states during its lifetime. The state of a transaction is defined by the current activity it is performing.

At a particular instant of time, a transaction can be in one of the following state −

  • Active − Transaction is executing.
  • Failed − Transaction fails to complete successfully.
  • Abort − changes made by transaction are cancelled (roll back).
  • Partially commit − Final statement of transaction is executed.
  • Commit − Transaction completes its execution successfully.
  • Terminated − Transaction is finished.

The states of transaction are diagrammatically represented as follows −

A transaction will terminate either when it commits or when it is aborted.

Updated on: 06-Jul-2021

17K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements