Explain the phases a transaction has to undergo.The several phases a transaction has to go through are listed here. Database is in a consistent state when the transaction is about to start.
1. The transaction starts processing explicitly with the BEGIN TRANSACTION statement. 2. Record is written to the log when the transaction generates the first log record for data modification. 3. Modification starts one table at time. Here database is in inconsistent state. 4. When all of the modifications have completed successfully and the database is once again consistent, the application commits the transaction. 5. If some error it undoes (or rolls back) all of the data modifications. This process returns the database to the point of consistency it was at before the transaction started.Explain the phases a transaction has to undergo. - Active state: This phase is divided into two states: - Initial phase: This phase is achieved when the transaction starts. - Partially Committed phase: This is achieved when the transactions final statement has been executed. Even though the final statement is finished execution, the transaction may abort due to some failure. - Failed state: This state is reached when the normal execution fails. - Aborted state: A transaction is aborted when the system feels it needs to be failed. This state should not have any effect on the system and thus all changes done until it were aborted; are rolled back. - Committed: After the transaction is successfully executed, it enters the committed state. In this state all changes are committed. These committed changes cannot be undone or aborting.
|