Types of locks in database ?

Answer Posted / mahesh reddy g

lockmodes:
EXCLUSIVE
SHARE
ROW EXCLUSIVE
SHARE ROW EXCLUSIVE
ROW SHARE* | SHARE UPDATE*If NOWAIT is omitted Oracle
will wait until the table is available.

Several tables can be locked with a single command -
separate with commas

e.g. LOCK TABLE table1,table2,table3 IN ROW EXCLUSIVE MODE;

Default Locking Behaviour

A pure SELECT will not lock any rows.

INSERT, UPDATE or DELETE's - will place a ROW EXCLUSIVE
lock.

SELECT...FROM...FOR UPDATE NOWAIT - will place a ROW
EXCLUSIVE lock.

Multiple Locks on the same rows with LOCK TABLE

Even when a row is locked you can always perform a SELECT
(because SELECT does not lock any rows) in addition to
this, each type of lock will allow additional locks to be
granted as follows.

ROW SHARE = Allow ROW EXCLUSIVE or ROW SHARE or SHARE locks
to be granted to the locked rows.

ROW EXCLUSIVE = Allow ROW EXCLUSIVE or ROW SHARE locks to
be granted to the locked rows.

SHARE ROW EXCLUSIVE = Allow ROW SHARE locks to be granted
to the locked rows.

SHARE = Allow ROW SHARE or SHARE locks to be granted to the
locked rows.

EXCLUSIVE = Allow SELECT queries only

Although it is valid to place more than one lock on a row,
UPDATES and DELETE's may still cause a wait if a
conflicting row lock is held by another transaction.

* = Oracle 6 option included for compatibility

Is This Answer Correct ?    30 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how can we know the number of days between two given dates using mysql? : Sql dba

537


what are all types of user defined functions? : Sql dba

534


Define concurrency control. : Transact sql

580


what is the difference between ereg_replace() and eregi_replace()? : Sql dba

544


What is a function in oracle pl sql?

529






What does dml mean?

536


What is graph sql?

518


What is pl sql script?

558


What are tables and fields in the database?

545


What is rtm stands for?

571


How to start oracle sql developer?

550


When sql appeared?

611


what is the difference between undefined value and null value? : Sql dba

550


Will truncate release space?

508


How to run pl/sql statements in sql*plus?

582