Seminar 6 - Subject I
Seminar 6 - Subject I
T1 T2
use DBMS_Sem6_online use DBMS_Sem6_online
go go
1
1. c
2. c
3. b, c, d
In this interleaved execution in SQL Server, the order of the operations is:
* the initial value for the record with CustomerID=2 from the table Customer is, for the field
City = Timisoara
- T1, executes the select from the Customer table, getting the shared lock on this table
- The next operation is the update from T2, that is also getting an exclusive lock (we also know,
that, exclusive locks protect updates to file resources and can be owned by only one transaction
at a time). In this transaction, T2, the table Customer is updated for the record with the
CustomerID=2 (the new value for the City becomes Cluj-Napoca).
2
- The next operation is the update from T1, that also needs an exclusive lock. In this transaction,
T1, the table Customer is updated for the record with the CustomerID=2 (the new value for the
City becomes Bucuresti).
So, for the update operation, both transactions need the exclusive lock.
WRITE LOCK = EXCUSIVE LOCK (X) = UPDATE statement / INSERT statement / DELETE
statement
From Seminar 3: