Transaction Concepts
Transaction Concepts
UNIT IV - Transaction
Transaction Concepts – ACID Properties – Schedules – Serializability – Concurrency
Control – Need for Concurrency – Locking Protocols – Two Phase Locking – Deadlock –
Transaction Recovery – Save Points – Isolation Levels – SQL Facilities for Concurrency and
Recovery.
Transaction Concepts
A transaction is a single, logical unit of work that consists of one or more related tasks. A
transaction is treated as a single, indivisible operation, which means that either all the tasks
within the transaction are executed successfully, or none are.
Transaction States in DBMS
During the lifetime of a transaction, there are a lot of states to go through. These states update
the operating system about the current state of the transaction and also tell the user about how
to plan further processing of the transaction. These states decide the regulations which decide
the fate of a transaction whether it will commit or abort.
The ROLLBACK statement undo the changes made by the current transaction. A transaction
cannot undo changes after COMMIT execution.
Isolation in DBMS
Isolation is defined as a state of separation. Isolation is an ACID Property in DBMS where no
data from one database should impact the other and where many transactions can take place at
the same time. In other words, when the operation on the first state of the database is finished,
the process on the second state of the database should begin. It indicates that if two actions are
conducted on two different databases, the value of one database may not be affected by the
value of the other. When two or more transactions occur at the same time in the case of
transactions, consistency should be maintained. Any modifications made in one transaction will
not be visible to other transactions until the change is committed to the memory.
Active − This is the state in which a transaction is being executed. Thus, it is like the initial
state of any given transaction.
Partially Committed − A transaction is in its partially committed state whenever it executes
the final operation.
Failed − In case any check made by a database recovery system fails, then that transaction is
in a failed state. Remember that a failed transaction can not proceed further.
Aborted − In case any check fails, leading the transaction to a failed state, the recovery manager
then rolls all its write operations back on the database so that it can bring the DB (database)
back to the original state (the state where it actually was prior to the transaction execution). The
transactions in this state are known to be aborted. A DB recovery module can actually select