I am learning Oracle Lock.
In the one session
lock table countries in ROW Exclusive mode nowait;
In the another session, I update counties table.
SQL> update countries set country_name = 'ddd';
25 rows updated.
what I expected is the session will hang. do you know why ?
And I check EM, I do see the lock.
ROW EXCLUSIVE
doesn’t actually lock the table completely.
ROW EXCLUSIVEandROW SHAREallows concurrent access but prevents anyone else locking the entire table for exclusive access.Exclusive also prohibits other actions from locking the table in SHARE mode.
If you want to lock the table from anything but Reads; you need to omit ROW so
There are more examples here: http://docs.oracle.com/cd/B14117_01/server.101/b10759/statements_9015.htm