what are the differences among these table level lock
modes - IN SHARE MODE, IN SHARE UPDATE MODE, IN EXCLUSIVE
MODE ?

Answer Posted / anil kumar jaiswal

Lock : Lock is a mechanism to prevent destructive interaction between users using same source at same time.
mainly lock is two types :

row level lock and table level lock.

Row level lock : in this a row is locked exclusively so others can not modify the rows until the transaction holding the lock is commited or rolled back.

syntax : lock table table_name where sal>3000(any condition) for update of comm(a column name);

table level lock consist 3 type :

a) share mode lock.
b)share update mode.
c)share exclusive mode.

share mode : allow users to query but not able to perform dml operation on the table being locked in shared mode. multi user can place share lock on same resource at same time.
syntax : lock table table_name in share mode;

share update lock : its used to lock the rows that need to be updated and also allow other user to access other rows of the table.
it just prevent users to use the same row is updating.
in share update mode users can perform all task like insert,delete,update.

syntax : lock table table_name in share update mode;

Exclusive mode : you can give same definition written for share lock. the only difference is only 1 user can place exclusive lock on a table at a time.

syntax : lock table emp in share exclusive mode;

Note : After explaining concept of locks i like to share some info about deadlock.

what is deadlock : when 2 user have a lock each on separate object, and wants to acquire a lock on each other objects when this happen. the first user need to wait for the 2nd user to release the lock but the 2nd user will not release the lock untill he found first user object freed. in this scenario oracle detect deadlock automatically and solve the problem by aborting one of the transaction.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is java sql drivermanager?

539


What is execution plan in sql?

542


What is update query?

541


What is the difference between microsoft sql and mysql?

502


Is pl sql different from sql?

524






What is PL/SQL Records?

616


What are sql functions? Describe the different types of sql functions?

548


Explain correlated query work?

583


What is primary key and foreign key with example?

486


Can we use pl sql in sql server?

536


What are the types of dbms?

541


What is localdb mssqllocaldb?

608


Why is %isopen always false for an implicit cursor?

560


What is query syntax?

515


Table A Table B 1 1 2 1 3 1. Union & union all --> A Union B , A Union all B 2. Minus , Intersect --> A minus B , B Minus A , A Intersect B 3. Joins A join B , A Left Join B A Right Join B , A full Join B 4. %Type - Uses & Benifit 5. Truncate & Delete 6. Pragma Autonomus Transaction 7. how to Perform DDL from function or procedure 8. Can we have DML inside Function 9. Rank & Dense Rank diffrence 10. Water Mark in Oracle 11. Index , Can we have index in all column of table if no then why ?

528