what are the differences among these table level lock
modes - IN SHARE MODE, IN SHARE UPDATE MODE, IN EXCLUSIVE
MODE ?
Answers were Sorted based on User's Feedback
Answer / raji_4u
in share mode :
this mode is for read only on entire table.
we can not make changes to table.
any user can have a lock in share mode at same time.
in share update mode :
this mode is used to lock the selected rows for update.
this mode acquires lock on selected rows only,not entire table.
other user can have lock on other rows on the same table but
not on the rows you have locked.
in exclusive mode :
this acquires lock on entire table.
another user can not have any lock on that table.
| Is This Answer Correct ? | 21 Yes | 1 No |
Answer / ajay.lavanuru
The lock mode convey the message of lock status starting
from low level hierarchy to high level hierarchy.
exclusive lock ---high priority
if this lock is enabled then 1 cant do nothing on the table.
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / 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 |
Describe the Index, Types of index, At what situation we have used? Which one s better than others?
What are the blocks in stored procedure?
Does normalization improve performance?
What is a unique key and primary key and foreign key?
is it necessary to write group by and order by clause together
Why partition by is used in sql?
What is optimistic concurrency control? : Transact sql
Explain the PL/SQL compilation process.
What is the difference between microsoft sql and mysql?
Hi All, I am new to both this blog and technology. I was able to see a response for one of the questions on triggers as below. I would like to know why are we using " if rtrim(to_char(sysdate,'day'))=rtrim('sunday') then" instead, can't we use " if sysdate = 'sunday' then". I can understand the use of "rtrim", but dont know y v r using to_char. I have seen this in many cases but did not get a convincible explaination. Please help me with this and do excuse if this question sounds silly. Thanks in advance...... create or replace trigger trg_sun before insert on <table name> begin if rtrim(to_char(sysdate,'day'))=rtrim('sunday') then raise_application_error(-20345,'no transaction in sunday'); end if; end trg_sun;
What are the types of index in sql?
what is global variable in pl/sql
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)