Oracle Learning----DDL Lock comprehension

Source: Internet
Author: User

DDL locks are divided into three types

1. Exclusive DDL Lock

2. Sharing DDL Locks

3. Can interrupt the resolution lock

Most DDL have exclusive DDL locks, such as a table being modified, you can use Select to query data, but most operations are not allowed, including all other DDL statements.

However, in Oracle, there are some DDL operations that do not have DDL locks to occur. such as online CREATE index

Online index creation with Dl,od, low-level TM lock, but no exclusive DDL lock

DL directly loads the lock, the direct load path to the table and the creation of the index cannot be done at the same time.

The OD lock online DDL supports true online.

Low-level TM locks prevent other DDL from occurring, while also allowing DML to perform normally

Another type is shared DDL locks

When you create a procedure or view, a shared DDL lock is added to the table involved, so that you can modify the contents of the table but you cannot modify the structure of the table.

Interruptible Parse Lock

When a session resolves a statement, a parse lock is applied to each object that the statement refers to, which is to brush out the parsed cache statement in the shared pool if the reference object is deleted or modified in some way.

Query the lock condition of the specified table
Select
(select username from v$session where sid=v$lock.sid) Username,
Sid
ID1,
ID2,
Lmode,
Request,block,v$lock.type
From V$lock
where id1=73834;//object_id query by user_objects

Queries the current session for an interruptible resolution lock, which is to find that the code cannot be compiled or timed out waiting for the query to find out who is using the
Set Linesize 1000
Select session_id Sid,owner,name,type,mode_held held,mode_requested Request
From Dba_ddl_locks
where session_id = (select Sid from V$mystat where rownum=1);

Oracle Learning----DDL Lock comprehension

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.