Chapter 3 - Copy
Chapter 3 - Copy
Chapter 3 - Copy
Introduction to Transaction
Processing Concepts
ACID properties:
Atomicity: A transaction is an atomic unit of processing; it is
either performed in its entirety or not performed at all.
Consistency preservation: A correct execution of the transaction
must take the database from one consistent state to another.
Isolation: A transaction should not make its updates visible to
other transactions until it is committed; this property, when
enforced strictly, solves the temporary update problem and
makes cascading rollbacks of transactions unnecessary
Durability or permanency: Once a transaction changes the
database and the changes are committed, these changes must
never be lost because of subsequent failure.
is a correct schedule.
It will leave the database in a consistent state.
The interleaving is appropriate and will result
New rows being read using the same read with a
condition.
A transaction T1 may read a set of rows from a table,
perhaps based on some condition specified in the SQL
WHERE clause.
Now suppose that a transaction T2 inserts a new row
that also satisfies the WHERE clause condition of T1,
into the table used by T1.
If T1 is repeated, then T1 will see a row that
previously Prepared
did not exist,
by Elisaye called a phantom.
B. @WSU-DTC 38
Transaction Support in SQL2 (6)
Sample SQL transaction:
EXEC SQL whenever sqlerror go to UNDO;
EXEC SQL SET TRANSACTION
READ WRITE
DIAGNOSTICS SIZE 5
ISOLATION LEVEL SERIALIZABLE;
EXEC SQL INSERT
INTO EMPLOYEE (FNAME, LNAME, SSN, DNO, SALARY)
VALUES ('Robert','Smith','991004321',2,35000);
EXEC SQL UPDATE EMPLOYEE
SET SALARY = SALARY * 1.1
WHERE DNO = 2;
EXEC SQL COMMIT;
GOTO THE_END;
UNDO: EXEC SQL ROLLBACK;
THE_END: ...
TEST1=10%
Prepared by Elisaye B. @WSU-DTC 40