Transaction States in DBMS
States through which a transaction goes during its lifetime are known as transaction states. These states tells about the current state of the Transaction.
Types Of Transaction States
There are six major types of Transaction states which are as given below
- Active state
- Partially committed state
- Committed state
- Failed state
- Aborted state
- Terminated state
Detail diagram of transaction states as below
1. Active State
- When the instructions of the transaction are executing then the transaction is in active state.
- In case of execution of all instruction of transaction, Transaction can go to “partially committed state” otherwise go to “failed state” from active state.
2. Partially Committed State
- After the execution of all instruction of a transaction, the transaction enters into a partially committed state from active state.
- At this stage, Still Changes are possible in transaction because all the changes made by the transaction are still store in the buffer of main memory.
3. Committed State
- Committed state permanently store all changes made by the transaction into the database
- Now, the transaction is consider as fully committed.
4. Failed State
- When a transaction is in the “active state” or “partially committed state” and some failure occurs then it becomes impossible to resume its execution, So it enters into a failed state.
Note: At this stage, Transaction cannot go to “partially committed state” or “active state” .
5. Aborted State
- As we know failed state can never be resuming but it is possible to restart the failed transaction. To restart the failed transaction Rollback method comes into picture.
- When we rollback (restart) the failed transaction the all the changes made by that transaction earlier have to be undone.
6. Terminated State
- This is the last stage of transaction in its life cycle.
If any transaction comes from “Aborted state” or “committed state” then that transaction is terminated and get ready to execute the new transactions.