java - Delete row and delete table lock oracle -
i have 2 query
1.delete x;
2.delete x y='a'
what type of lock oracle 11 g provide above query?
and suppose iterate below query in program
delete x y='$a'
let have list of number 1,2,3,4.. if same program called 2 server 1 server delete 1,3... , other server delete 2,4...?
1) since there no clause, rows locked in table user session. 2) rows matching clause locked. oracle uses row level locking setting lock bit in data block row.
unless , until commit issued - no other session see these deletions. oracle use rollback information - created each separate delete (or dml operation) statement provide read consistent view other session. meaning: other sessions see table without deletions. once rows locked - other sessions prevented issuing delete against rows , user blocked, waiting rows committed or rolled back. can test 2 sqlplus sessions.
if want know more locks, @ tom kyte's excellent book, expert oracle db architecture.
yes, 2 different sessions can delete different sets of rows. oracle not full table locking default (it lock table during dml prevent structural changes table while changes pending), 1 session not block another.
Comments
Post a Comment