States of Transaction in DBMS

States of Transaction

In databases, transactions can be in multiple forms. These forms are shown in the figure below.

 

 

Active State

  • The first state of each and every transaction in a database is always in the active state. In the active state, the transaction is being executed.
  • For example, the insertion of data in a database is done in this state, but the transaction is not saved to the database.

Partially Committed

  • In this state, the transaction is in the last operation, but it not saved to the database yet.
  • In an example where total marks are calculated, the stage of displaying the total marks is in this state.

Committed

  • In the state where all the transactions are stored on the database is known as the committed state. Here, all the operations are completed successfully.

Failed State

  • The database system makes its checks, and if even one of them fails in the database recovery system, the transaction is said to be in the failed state.
  • For example: If the database isn’t able to fire any query, the transaction is determined as failed.

Aborted

  • If the checks by the database recovery system fail, the DBMS takes the database to the previous consistent state. If not, then the transaction is rolled back or aborted to make the database consistent again.
  • After aborting the transaction, it DBMS may restart the transaction or kill it.

 

Please Share