首页 > 其他分享 >[20231027]Index ITL Limit 2.txt

[20231027]Index ITL Limit 2.txt

时间:2023-10-30 21:57:50浏览次数:56  
标签:20231027 ITL 06512 RECURSIVE 8ORA SCOTT line txt

[20231027]Index ITL Limit 2.txt

--//链接https://jonathanlewis.wordpress.com/2022/02/18/index-itl-limit/,重复测试
--//如果例子插入语句
insert into itl_limit values(200 - i_tx_count);
--//修改为
insert into itl_limit values( i_tx_count);
--//采用顺序插入,看看结果如何。

1.环境:
SCOTT@book> @ ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

2.测试脚本:
rem
rem     Script:         itl_limit.sql
rem     Author:         Jonathan Lewis
rem     Dated:          Dec 2010
rem
rem     Last tested
rem             19.3.0.0
rem             12.2.0.1
rem             12.1.0.2
rem             11.1.0.6
rem

create table itl_limit(n1 number) pctfree 0;
create unique index il_01 on itl_limit(n1) pctfree 0;

create or replace procedure recursive_itl(i_tx_count number)
as
        pragma autonomous_transaction;
begin
        if i_tx_count != &&1 then
                --//insert into itl_limit values(200 - i_tx_count);
                insert into itl_limit values(i_tx_count);
                --//recursive_itl(i_tx_count - 1);
                recursive_itl(i_tx_count + 1);
                commit;
        end if;
end;
/

alter session set events '10046 trace name context forever, level 8';

--//execute recursive_itl(200);
execute recursive_itl(1);

alter system checkpoint;

alter session set events '10046 trace name context off';

prompt  ==========================================
prompt  If there is no index on the table then you
prompt  should see 169 rows in one block and 31 in
prompt  the other. But if there is an index there
prompt  should be no rows thanks to the rollback
prompt  caused by the error.
prompt  ==========================================

select
        dbms_rowid.rowid_block_number(rowid), count(*)
from
        itl_limit
group by
        dbms_rowid.rowid_block_number(rowid)
;

prompt  =================================
prompt  Try for a tree dump on the index
prompt  after which you can dump the root
prompt  block to see the ITL entries
prompt  =================================

column object_id new_value m_object_id

select  object_id, object_type, object_name
from    user_objects
where   object_name = 'IL_01'
/

alter session set events 'immediate trace name treedump level &m_object_id ';

3.测试:
SCOTT@book> @ itl_limit.txt 200
Table created.
Index created.
Procedure created.
Session altered.
BEGIN recursive_itl(1); END;

*
ERROR at line 1:
ORA-00060: deadlock detected while waiting for resource
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 7
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8
ORA-06512: at "SCOTT.RECURSIVE_ITL", line 8

System altered.

Session altered.

==========================================
If there is no index on the table then you
should see 169 rows in one block and 31 in
the other. But if there is an index there
should be no rows thanks to the rollback
caused by the error.
==========================================

no rows selected

=================================
Try for a tree dump on the index
after which you can dump the root
block to see the ITL entries
=================================
 OBJECT_ID OBJECT_TYPE         OBJECT_NAME
---------- ------------------- ------------------------------
     90552 INDEX               IL_01

--//0x10002b3 = set dba 4,691 = alter system dump datafile 4 block 691 = 16777907
--//可以发现测试结果一样,也是要找ITL槽.不需要倒序插入,正序也可以出现问题.
--//测试输入参数=170就出现死锁情况,如果设置参数169,ok,插入168条记录.

Leaf block dump
===============
header address 140249315344396=0x7f8e569f000c
kdxcolev 0
KDXCOLEV Flags = - - -
kdxcolok 0
kdxcoopc 0x80: opcode=0: iot flags=--- is converted=Y
kdxconco 1
kdxcosdc 0
kdxconro 0
kdxcofbo 36=0x24
kdxcofeo 4024=0xfb8
kdxcoavs 3988
kdxlespl 0
kdxlende 0
kdxlenxt 0=0x0
kdxleprv 0=0x0
kdxledsz 6
kdxlebksz 4024
*** dummy key ***
row#0[4013] flag: ------, lock: 2, len=11, data:(6):  01 00 02 ac 00 00
col 0; len 2; (2):  c1 02
----- end of leaf block dump -----
End dump data blocks tsn: 4 file#: 4 minblk 691 maxblk 691
--//注意转储记录1条记录,lock=2.无效.

$ grep "^WAIT.*TX"   /u01/app/oracle/diag/rdbms/book/book/trace/book_ora_62284.trc >| itl.txt

$ awk '{print  $10}' itl.txt | paste - - - - - - - - - - - -
1000309 1000822 1000985 1000886 1000882 1000922 1000921 1000886 1000870 1000954 1000907 1000872
2000916 2000884 2000471 2000775 2000658 2001180 2000924 2000651 2001133 2000608 2000884 2000920
4001892 4001905 4001902 4001914 4001884 4001929 4001877 4001930 4001894 4001906 4001869 4001914
5001824 5001897 5001904 5001884 5001867 5001892 5001919 5001878 5001927 5001894 5001902 3000864

$ awk '{print  $10}' itl.txt | paste $(seq 12 | xargs -IQ echo '-'| paste -sd' ')
$ awk '{print  $10}' itl.txt | paste -d" " $(seq 12 | xargs -IQ echo -n '- ')
1000309 1000822 1000985 1000886 1000882 1000922 1000921 1000886 1000870 1000954 1000907 1000872
2000916 2000884 2000471 2000775 2000658 2001180 2000924 2000651 2001133 2000608 2000884 2000920
4001892 4001905 4001902 4001914 4001884 4001929 4001877 4001930 4001894 4001906 4001869 4001914
5001824 5001897 5001904 5001884 5001867 5001892 5001919 5001878 5001927 5001894 5001902 3000864
--//你可以发现一个特点.12个ITL槽为1组,开始1秒,然后2秒,然后4秒,然后5秒,最后1个检测3秒,死锁.

$ awk '{print  $10}' itl.txt | paste -sd'+' | bc
142064688
--//共计142秒.

--//ITL等待检测的伪代码如下:
iteration = 0
LOOP
  iteration++
  FOR i IN itl.FIRST..itl.LAST
  LOOP
    EXIT WHEN itl(i) IS FREE
    IF i <> itl.LAST THEN
        WAIT ON itl(i) FOR min(power(2,iteration-1),5) SECONDS
    ELSIF iteration <= 10 THEN
        WAIT ON itl(i) FOR power(2,iteration-1) SECONDS
    ELSE
        WAIT ON itl(i) FOREVER
    END IF
  END LOOP
  EXIT WHEN free_itl_found
END LOOP

--//最大12个ITL槽为1组,开始1秒,然后2秒,然后4秒,然后5秒,最后1个ITL等待秒数是 2^(迭代次数-1).再然后还是5秒,最后1个ITL等待秒数
--//是 2^(迭代次数-1),在迭代10次以后,第11次迭代,其它ITL等待5秒,最后1个ITL无限等待下去,有空再次验证看看,主要是检测时间有点长.

标签:20231027,ITL,06512,RECURSIVE,8ORA,SCOTT,line,txt
From: https://www.cnblogs.com/lfree/p/17798934.html

相关文章

  • [20231023]备库与alter system flush buffer_cache.txt
    [20231023]备库与altersystemflushbuffer_cache.txt--//测试遇到的问题,在备库执行altersystemflushbuffer_cache;刷新数据缓存命令无效.--//通过例子验证:1.环境:[email protected]:1521/orcl>@[email protected]:1521/orcl>@pr==============================P......
  • RC2104-WS_EX_COMPOSITED-WS_EX_NOINHERITLAYOUT
    VS编译出现RC2104,或者打开资源出现错误提示未定义#include"afxres.h"....2TEXTINCLUDEBEGIN"#include""afxres.h""\r\n""\0"END修改为#include<windows.h>#include"afxres.h"...2TEXTINCLUDE......
  • https://gitlab.com/volian/nala/-/wikis/Installation
    Installation DebianTesting/SidNalaisofficiallyinthetestingandsidrepos.sudoaptinstallnalaVolianScarAlternativelyyoucanusethe VolianScar repo.UpdatesfromthisrepoareslightlyfasterthantheDebianrepos,butusuallyonlyabo......
  • 20231027
    23/10/27NOIP模拟赛总结时间安排:7:40-8:30看T1,没啥思路,一开始以为是组合数,写了个递推求组合数发现是最简单的DP,测样例,手搓了几组小样例都过了。8:30-8:50T2只会模拟,写的get函数有点麻烦,耽误了一些时间。9:00-9:30看T3T4都没想到,去写T5暴力。9:30-10:20T5暴力取模的地方......
  • 20231027NOIP训练赛
    20231027NOIP训练赛时间安排7:40-9:20写T19:20-10:20写T210:20-11:10写T3T411:10-11:50写T5总结T1写挂了,T3的set超时了题解T1简单DP题T2把加转化为差分,差分数组进行区间加操作,用线段树维护T3用一个栈维护一下没有被匹配的字符即可T4结论题,答案要么删掉一个点,要......
  • 20231027
    20231027NOIP#25总结时间安排7:40~8:10看题\(A\)一眼切,\(B,C,D,E\)都不会。8:10~8:30写\(A\),但这个题坑真多。8:30~8:50写\(C\),这个好像是原题。8:50~9:50写\(B\),带些许数学的模拟,有点难写。9:50~10:35写\(E\)的前两档,但第二档做法假了。10:35~11:30反应了......
  • python读取和写入txt等文件,文件打开模式,文件对象常用函数
     ......
  • Python requirements.txt安装用法介绍
    一、什么是requirements.txt文件在Python项目开发中,通常需要安装多个Python包。当我们在新的项目中启动一个虚拟环境,并且想要在新的虚拟环境中安装之前的依赖包时,就可以使用requirements.txt文件来完成。这个文件包含了所有需要安装的依赖包和其版本号。requirements.txt文件可以在......
  • gitlab_ci _cd
    首先部署gitlab>参考https://help.aliyun.com/zh/ecs/use-cases/deploy-and-use-gitlab安装一个minikubecurl-LOhttps://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64sudoinstallminikube-linux-amd64/usr/local/bin/minikube不能是使用root......
  • ASD光谱数据如何转为TXT格式?
      本文介绍基于ViewSpecPro软件,将ASD地物光谱仪获取到的.asd格式文件,批量转换为通用的.txt文本格式文件的方法。  ASD光谱仪是英国MalvernPanalytical公司研发的系列野外便携式全范围光谱辐射仪和光谱仪,可以获取地物的实时光谱信息。我们用这一系列中的设备产品对地物的光谱......