Transaction Recovery | Database Management System
Transaction RecoveryВ | Database Management System
Transaction Recovery : A transaction begins with the successful execution of a BEGIN TRANSACTION statement and ends with the successful execution of a COMMIT or ROLLBACK statement. Thus, a COMMIT establishes a COMMIT POINT (also called syncpoint) at which database is in a state of consistency. A ROLLBACK rolls back the database to the previous COMMIT POINT, at which again database was in a state of consistency. When a COMMIT POINT is established:
- All updates made by the program since the previous COMMIT POINT are committed i.e., are made PERMANENT.
- All database positioning (i.e., addressability to certain tuples) is lost and all tuple-locks are released. Some systems provide an option to retain addressability to tuples (and tuple locks) from One transaction to next.
COMMIT and ROLLBACK terminate a transaction, but not the program. A single program execution will Comprise a sequence of transactions.
System does not assume application programs to include explicit tests for all errors. System will issue implicit ROLLBACK for any program that fails for any reason to reach its planned termination, even if it has not been Specified so explicitly by the program (as done in the TRANSACTION example above). So, a transaction is also used as a unit of recovery.
If a transaction SUCCESSFULLY COMMITS, the system will guarantee that all its updates are permanently installed in the database, even if the system crashes before the updates are physically written into the database. With the help of log, the System would write such updates physically into the database during RESTART after the failure. The RESTART procedure will recover any transactions that completed successfully but did not manage to get their updates physically written prior to crash.
The ACID properties of Transactions
The transactions have four important properties:
- Atomicity: Transactions are atomic (all or nothing).
- Consistency: Transactions transform a consistent state of the database into another consistent State, without necessarily preserving consistency at all intermediate steps.
- Isolation: Transactions are isolated from one another. Even though many transactions may be running Concurrently, but updates of a transaction are hidden from others until it commits.
- Durability: Once a transaction commits, its updates survive, even if system crashes before the updates are physically written into the database.