Professional Documents
Culture Documents
6) Data Con Currency
6) Data Con Currency
Vikas Manoria
IT Specialist – IBM Academic Initiative
vmanoria@in.ibm.com
2
IBM DB2 9
Database Transactions
A transaction (also known as a unit of work ) is a
recoverable sequence of one or more SQL operations, grouped
together as a single unit, usually within an application process.
Role of COMMIT, Auto-Commit and ROLLBACK
ACID = Atomicity, Consistency, Isolation and Durability
In single-user environments, each transaction runs serially
and doesn't interfere to other transactions.
In multi-user environments, transactions can (and often do)
run simultaneously. As a result, each transaction has the
potential to interfere with other active transactions.
3
IBM DB2 9
4
IBM DB2 9
5
IBM DB2 9
6
IBM DB2 9
7
IBM DB2 9
9
IBM DB2 9
10
IBM DB2 9
Locking
A lock is a mechanism
that is used to associate
a data resource with a
single transaction, for
the sole purpose of
controlling how other
transactions interact
with that resource while
it is associated with the
transaction that has it
locked.
11
IBM DB2 9
Lock Attributes
resource being locked is called object.
objects which can be explicitly locked are databases,
tables and table spaces.
objects which can be implicitely locked are rows,
index keys, tables. Implicit locks are acquired by DB2
according to isolation level and processing situations.
object being locked represents granularity of lock.
length of time a lock is held is called duration and is
affected by isolation level.
12
IBM DB2 9
13
IBM DB2 9
Deadlock
14
IBM DB2 9
15
IBM DB2 9
17
IBM DB2 9
A. Repeatable Read
B. Read Stability
C. Cursor Stability
D. Uncommitted Read
18
IBM DB2 9
20
IBM DB2 9
25
IBM DB2 9
Grazie Hebrew
Italian
Gracias Spanish
Russian
Obrigado
Thank
Portuguese
Arabic
Merci
French
Traditional Chinese
You English
Danke
German
Thai
Simplified Chinese Tamil
Japanese Korean
26