关于enq:TX -allocate ITL entry

来源:互联网 发布:exe软件代码修改 编辑:程序博客网 时间:2024/06/05 09:37

当表的ITL设置不能满足并发事务的需求时会产生此等待。数据块时oracle能够发出的最小i/o单位。在数据块中,数据块每当一个事务需要修改一个数据块时,需要在数据块头部获得一个可用的ITL槽,其中记录了当前事务的id,使用的undo数据块,还有对应的scn,事务是否提交等信息。进一步来说ITL槽的设置是由ini_trans,max_trans决定。在10g之后,nax_trans参数被忽略了。

SQL> set linesize 200SQL> col table_name format a30SQL> create table trans_test(id number,name varchar2(100)) initrans 1 maxtrans 1;Table created.SQL> select ini_trans,max_trans,table_name from user_tables where table_name='TRANS_TEST'; INI_TRANS  MAX_TRANS TABLE_NAME---------- ---------- ------------------------------         1        255 TRANS_TEST

In earlier releases, the MAXTRANS parameter determined the maximum number of concurrent update transactions allowed for each data block in the segment. This parameter has been deprecated. Oracle now automatically allows up to 255 concurrent update transactions for any data block, depending on the available space in the block.

Existing objects for which a value of MAXTRANS has already been set retain that setting. However, if you attempt to change the value for MAXTRANS, Oracle ignores the new specification and substitutes the value 255 without returning an error.

对于initrans,maxtrans的默认值,表级为1,索引级为2.  一般来说不需要做特别的设置。可以根据业务的需要来配置。


对于此等待事件,解决思路有三种:

1. increase initrans

a. 根据对目标表并发事务的需求调整参数

SQL> alter table trans_test INITRANS 50; Table altered.

b. alter table move以重新组织表

SQL> alter table trans_test move;Table altered.

c. 重建目标表上的所有索引

alter index rebuild INITRANS 50; 

2. increase pctfree

将pctfree参数调大可以为数据块保留更多的预留空间,这样表中的数据就可以分布在更多的数据块上,也就意味着有更多的事务槽可用了

a. 调整pctfree参数

SQL> alter table trans_test pctfree 40;Table altered.

b. alter table move

c. 重建目标表上的索引



对于大表,数据千万级以上的表,initrans建议设置为8~16
对于中级表,数据量在百万到千万级,initrans建议设置为4~8
对于普通的表,initrans建议设置为1~4

0 0