Transaction Model in DBMS

Each transaction has following 5 states

Active

This is the first state of transaction and here the transaction is being executed. For example, updating or inserting or deleting a record is done here. But it is still not saved to the database. When we say transaction it will have set of small steps, and those steps will be executed here.

Partially committed

This is also an execution phase of transaction.  Here last step of transaction is executed. But data is still not saved to the database.  In our example of calculating total marks, final display the total marks step is executed in this state.

Committed

In this state, all the transactions are permanently saved to the database. This step is the last step of a transaction, if it executes without fail.

Failed

Because of the failure of the system or database, if a transaction cannot proceed to the execution state, then the transaction is said to be in failed state. In the total mark calculation example, if the database is not able fire a query to fetch the marks, i.e.; very first step of transaction, then the transaction will fail to execute.

Aborted

If a transaction is failed to execute, then the database recovery system will make sure that the database is in its previous consistent state. If not, it brings the database to consistent state by aborting or rolling back the transaction. If the transaction fails in the middle of the transaction, all the executed transactions are rolled back to it consistent state before executing the transaction. Once the transaction is aborted it is either restarted to execute again or fully killed by the DBMS.

Translate »