What is Transaction & Transaction log also Explain Transaction Properties or ACID Properties ?
![](http://img2.blogblog.com/img/icon18_edit_allbkg.gif)
https://www.computersprofessor.com/2016/07/what-is-transaction-transaction-log.html
Transaction:
A transaction is a logical unit of
work that must be entirely completed or entirely aborted no intermediate
states are accepted.
|
To understand the
transaction:
Suppose
you sell a product to a customer the transaction consists following
properties.
v
You
must write a new customer in invoice
v
You
must update the account transactions.
v
You
must update the customer balance.
|
In data base terms, a
transaction is any action that reads from and / or writes to a database .
Ex :
v
Simple
select statement generates a list of table contents.
v
Insert
statement to add rows to one or more tables.
|
Transaction
properties :
each individual transaction must satisfy the atomicity, consistency,
isolation , durability. These properties are called acid test.
|
Atomicity
:
perform all properties or cancel all properties.
|
all operations of a
transaction be completed. If not the transaction is aborted.
|
if the transaction T1
has 4 SQL request if any of the request fail cancel the first executed
request also.
|
Consistency
: Before
the transaction & after the transaction the result must be same.
|
Database is in always
consistent state.
|
Isolation
:one
transaction should not effect to another transaction (or)
|
|
Durability
:
once the transaction changes are done that means committed , they can not be
undone or lost even if any system failures.
|
Transaction
log :
Transaction log is used to keep track of all transactions that update the
data base.
|
The information stored in
this log is used by the DBMS for recovery requirements triggered by a rollback
statement.
|
Transaction
log stores:
v
A
record for the beginning of the transaction
v
For
each transaction in notes
v
What
type of operation being performed (update, delete, insert)
v
The
name of the objects affected by the transaction.
v
Before
& after values for the fields being updated.
v
The
ending of the transaction.
v
Each
and every transactions beginning, ending, time & processing (update,
insert, delete) details are noted in a file either manually or automatically.
The file is called transaction log.
|
Transaction log is used to recovery
the data base & provide precedence relationships among transactions.
|