Wednesday, January 15, 2014

RDBMS-- Lock Compatability Matrix for Oracle Database

I thought that "Lock Compatability Matrix for Oracle Database" should be present in this blog.
Following table compares the locking operations, relevant lock modes and describes whether they are permitted.  


* Waits if another transaction has a lock.

If you interpret these tables; we can see that;
  • You can do a select in every time, selects are independent.. You dont have to wait for anything.
  • To able to do an insert , there should not be a Share or Shared Row Exclusive or Exclusive lock on the table. You dont have to wait for another transaction..
  • To able to do an update, there should not be a Share or a Shared Row Exclusive or an Exclusive lock on the table.You have to waits if another transaction has a lock
  • To able to do an delete, there should not be a Share or a Shared Row Exclusive or an Exclusive lock on the table.You have to waits if another transaction has a lock
  • To able to do a select for update, there should not be an Exclusive lock on the table, and you have to wait if someone has a lock that prevents you.You have to waits if another transaction has a lock
Another representation can be the following;


If you interpret these tables; we can see that;

For example, you cant have a share on a resource , if there is an exclusive lock on it, and iff you have a share lock on a resource, nobody can put an exclusive lock on that resource, and so on..


No comments :

Post a Comment