Transaction States in DBMS With Example

In this post, we will learn about different transaction states in dbms with example. We will go through different transaction states – BEGIN, ACTIVE, COMMIT, ROLLBACK etc. in dbms.

Transaction States

A transaction is considered as an atomic operation, but in reality it goes through a number of states during its lifetime.

The transactions boundaries are specified by BEGIN-TRANSACTION and END-TRANSACTION statements. For recovery purpose (in case of data lost), the system needs to keep track of all these states.

Tutorialwing Transaction states in dbms with example

As above image clearly depicts, transaction states are –

  1. BEGIN : The database is in a consistent state before a transaction begins. The transaction on the database begins by the execution of the first statement of the transaction i.e. it becomes active.
  2. ACTIVE : In the active state, the transaction is modifying the database state. That means, a transaction is performing write operations on the database items, At the end of the active (modify) state, the transaction enters into one of the three states: start to commit, abort or error.
  3. COMMIT : In the start-to-commit state, the transaction instructs the DBMS to reflect the Change (made by the transaction) into the database . Once all these changes are done in the database, the transaction is said to be in the commit state.
  4. ROLLBACK : There is a possibility that all the changes made by the transaction are not transmitted to the database due to the hardware or system failures or any errors like dividing by zero. In this case, the transaction enters into the abort or error state and is roll back and ultimately ends the transaction. An aborted transaction that made no changes to the database is terminated (ended) without the need for a rollback.
  5. END : The transaction can be end in three different ways:

1. Successful termination : A transaction ends after a commit operation.

2. Suicidal termination : A  transaction detects an error during its processing and thus aborts and  performs a rollback operation.

3. Murderous termination : The operating system or DBMS can force the transaction to be aborted for any reason.


Leave a Reply