How [Oracle] observes the conflicts between various lock types in table

Source: Internet
Author: User

How [Oracle] observes the conflicts between various lock types in table


Example:

SESSION#15 Create a table:

SID 15
==============
CREATE TABLE T1 (C1 number)
Partition by range (C1)
(partition P1 values less than (' 11 '),
Partition P2 values less than (' 21 '),
Partition P3 values less than (' 31 ')
)
/

SESSION#15 the maximum lock on the table (exclusive)

Lock table T1 in exclusive mode; (T1 X (6) lock)

SESSION#137 other operations (ALTER TABLE ADD partition)

SID 137
==============
ALTER TABLE T1 ADD partition P4 values less than (' 41 '); (T1 S (4) lock, T1 X (60 cannot be shared, so blocked, will stay there)


To view the status of a lock

Sys> select * from V$locked_object;

Xidusn xidslot xidsqn object_id session_id oracle_username os_user_name PROCESS Locked_mode
---------- ---------- ---------- ---------- ---------- ------------------------------ ------------------------------ - ----------------------- -----------
0 0 0 87656 JIMMY ora11204 698 6
3 1056 87656 137 JIMMY ora11204 854 0
3 1056 137 JIMMY ora11204 854 3


At this point we can do other operations, anyway, everyone is blocked by the largest level of Exclusive lock, this time we can look at the lock they performed Locked_mode,
See if the lock types of the various operations are compatible.

sid#141
==============
INSERT into T1 values (28);

Sys> select * from V$locked_object;

Xidusn xidslot xidsqn object_id session_id oracle_username os_user_name PROCESS Locked_mode
---------- ---------- ---------- ---------- ---------- ------------------------------ ------------------------------ - ----------------------- -----------
6 1234 87659 141 JIMMY ora11204 927 3
6 1234 87656 141 JIMMY ora11204 927 3
...

How [Oracle] observes the conflicts between various lock types in table

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.