Types of locks in database ?

Answer Posted / shaheed ul haq sadi

1) Shared
A shared lock reserves its object for reading only. It
prevents the object from changing while the lock remains.
More than one program can place a shared lock on the same
object. More than one object can read the record while it is
locked in shared mode.

2) Exclusive
An exclusive lock reserves its object for the use of a
single program. This lock is used when the program intends
to change the object.

You cannot place an exclusive lock where any other kind
of lock exists. After you place an exclusive lock, you
cannot place another lock on the same object.

3) Promotable/Update

A promotable (or update) lock establishes the intent to
update. You can only place it where no other promotable or
exclusive lock exists. You can place promotable locks on
records that already have shared locks. When the program is
about to change the locked object, you can promote the
promotable lock to an exclusive lock, but only if no other
locks, including shared locks, are on the record at the time
the lock would change from promotable to exclusive. If a
shared lock was on the record when the promotable lock was
set, you must drop the shared lock before the promotable
lock can be promoted to an exclusive lock.

Is This Answer Correct ?    47 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between the conventional and direct path loader? : aql loader

642


What are the different schemas objects that can be created using pl/sql?

516


What is a procedure in pl sql?

539


what is a composite key ? : Sql dba

586


Is ms sql traffic encrypted?

493






how can we repair a mysql table? : Sql dba

534


What is oracle sql called?

497


what is meant by urlencode and urldocode? : Sql dba

592


What is record type in pl sql?

533


What do you understand by case manipulation functions?

539


What port does sql server use?

498


how to use myisamchk to check or repair myisam tables? : Sql dba

499


Difference between global and parameter variables?

1446


What are the two characteristics of a primary key?

481


How is debugging done?

523