Direct Path Insert - APPEND HINT and TM Enqueue LOCK Behaviour (文档 ID 1317447.1)

转到底部转到底部

In this Document

Symptoms
 Changes
 Cause
 Solution
 References


APPLIES TO:

Oracle Database - Enterprise Edition - Version 9.2.0.1 to 11.1.0.8 [Release 9.2 to 11.1]
Oracle Database - Personal Edition - Version 9.2.0.1 to 11.1.0.8 [Release 9.2 to 11.1]
Oracle Database - Standard Edition - Version 9.2.0.1 to 11.1.0.8 [Release 9.2 to 11.1]
Information in this document applies to any platform.
Issue is seen in 11.1 not on other Versions


SYMPTOMS

In 11.1 , using the /*+ APPEND */ hint to do direct path insert , TM Enqueue Contention occurs.

CHANGES

After having upgraded to 11.1.0.7

CAUSE

Change in  the behaviour  of the APPEND hint (Direct Path Insert)  

SOLUTION


It is explained in documentation that direct-path insert obtains exclusive locks on the table:

During direct-path INSERT, the database obtains exclusive locks on the table (or on all partitions of a partitioned table). As a result, users cannot perform any concurrent insert, update, or delete operations on the table, and concurrent index creation and build operations are not permitted. Concurrent queries, however, are supported, but the query will return only the information before the insert operation.


The behaviour of /*+ APPEND */ hint has changed in the different versions of Oracle:

  • In Oracle 10g and previous releases the APPEND hint is ignored when specifying INSERT..VALUES. Thus even though stated, the insert will be done in conventional mode and not use direct-path insert into the buffer cache. When using INSERT..SELECT the hint will be honoured.

  • On 11g Release 1, the APPEND hint will be honoured for an INSERT with VALUES and the row will be inserted directly into datafiles, bypassing the buffer cache.

  • In 11g release 2, a new hint has been added, /*+ APPEND_VALUES */ that will load the data directly into the datafiles.

To summarize, there are now 2 different hints for direct-path load:

  • APPEND: Instructs Oracle to use direct-path INSERT with the subquery syntax of the INSERT statement.
  • APPEND_VALUES: Instructs Oracle to use direct-path INSERT with the VALUES clause.


The following examples clarify the behaviour explained above:

INSERT .. VALUES and APPEND HINT

Version: 10.2.0.4

--SID=159: SQL> create table test_insert (id number, name varchar2(25)); SQL> insert /*+ APPEND */ into test_insert values (1,'Test1'); 1 row created. select sid,type,id1,id2,lmode from v$lock where sid=159; SQL> SID TY ID1 ID2 LMODE ---------- -- ---------- ---------- ---------- 159 TM 61245 0 3 159 TX 262153 3571 6

APPEND hint ignored and lock mode=3 Row Exclusive 

Version: 11.1.0.7

--SID=131:
SQL> create table test_insert (id number, name varchar2(25));
SQL> insert /*+ APPEND */ into  test_insert  values (1,'Test1');

1 row created.

select sid,type,id1,id2,lmode from v$lock where sid=131;

SQL> 
        SID TY        ID1        ID2      LMODE
---------- -- ---------- ---------- ----------
       131 TM      84239          0          6
       131 TX      65548       4981          6

APPEND hint honoured and lock mode=6 Exclusive 

Version: 11.2.0.3

--SID=59
SQL> create table test_insert (id number, name varchar2(25));
SQL> insert /*+ APPEND */ into  test_insert  values (1,'Test1');

1 row created.

select sid,type,id1,id2,lmode from v$lock where sid=59;

       SID TY        ID1        ID2      LMODE
---------- -- ---------- ---------- ----------
        69 TM      96843          0          3
        69 TX     196640       3301          6

APPEND hint ignored and lock mode=3 Row Exclusive 

INSERT .. VALUES and APPEND_VALUES HINT

Version: 11.2.0.3

--SID=134
SQL> create table test_insert (id number, name varchar2(25));
SQL> insert /*+ APPEND_VALUES */ into  test_insert  values (1,'Test1');

1 row created.

SQL> select sid,type,id1,id2,lmode from v$lock where sid=134;

       SID TY        ID1        ID2      LMODE
---------- -- ---------- ---------- ----------
       134 TM      96843          0          6
       134 TX      65565       7849          6

New APPEND_VALUES  hint honoured and lock mode=6 Exclusive 

INSERT .. SELECT and APPEND HINT 

All Versions

--SID=77
SQL> insert  /*+ APPEND */ into  test_insert select object_id,object_name from user_objects;

59 rows created.

SQL> select sid,type,id1,id2,lmode from v$lock where sid=77;

       SID TY        ID1        ID2      LMODE
---------- -- ---------- ---------- ----------
        77 TM      96843          0          6
        77 TX     589827       8029          6

APPEND hint honoured and lock mode=6 Exclusive 

REFERENCES

NOTE:1019527.6 - Script to Check for Foreign Key Locking Issues for a Specific User
NOTE:842374.1 - APPEND Hint (Direct-Path) Insert with Values Causes Excessive Space Usage on 11G
未找到您要查找的产品?
1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值