Oracle AWR之-enq: TX - allocate ITL entry

今天收到压力测试期间awr报告,测试人员要我看看数据库是否有可以优化的地方,数据库服务器配置信息:CPU:32*8,内存:480g 单实例数据库:oracle 11.2.0.4。具体分析过程如下:

clip_image002

clip_image004

可以发现,压力测试期间出现队列锁:enq: TX - allocate ITL entry。

clip_image006

通过Segments by ITL Waits发现等待的对象为hqoa_t_busi和hqoa_t_sendfile两张表:

clip_image008

通过sql执行时间发现了关于对象hqoa_t_busi表的dml语句,基本可以确定问题是由于压力测试期间并发大量对于该对象的update语句导致的数据库问题。

到这个地方,问题似乎很清晰了,就是由于表DIRECT_DEBIT_REQUEST的ITL的设置不能够满足并发事务的需求而导致的等待。数据块是oracle能够发出的最小I/O单位。在数据块中,数据块头部的ITL信息是至关重要的。
每当一个事务需要修改一个数据块时,需要在数据块头部获得一个可用的ITL槽,其中记录了当前事务的id,使用的undo数据块地址,还有对应的scn,事务是否提交等信息。如果一个新的事务发现ITL槽已经被使用,会重新
申请一个新的ITL槽,这个过程是动态的,进一步来说,ITL槽的设置是由ini_trans,max_trans来决定的,在10g之后,max_trans参数被忽略了。

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

通过查询相关信息,确定enq: TX - allocate ITL entry等待事件解决办法如下:

解决思路有3种

Increase INITRANS

A)

1) Depending on the number of transactions in the table we need to alter the value of INITRANS. here it has been changed to 50:

alter table INITRANS 50;

2) Then re-organize the table using move (alter table move;)
3) Then rebuild all the indexes of this table as below

alter index rebuild INITRANS 50;

Increase PCTFREE

If the issue is not resolved by increasing INITRANS then try increasing PCTFREE. Increasing PCTFREE holds more space back and so spreads the same number of rows over more blocks. This means that there are more ITL slots available overall :
B)

1) Spreading rows into more number of blocks will also helps to reduce this wait event.

alter table

 

  PCTFREE 40;

2) Then re-organize the table using move (alter table service_T move;)

3) Rebuild index

alter index index_name  rebuild PCTFREE 40;

A Combination of increasing both INITRANS and PCTFREE

1) Set INITRANS to 50  pct_free to 40

alter table PCTFREE 40  INITRANS 50;

2) Re-organize the table using move (alter table move;)
3) Then rebuild all the indexes of the table as below

alter index  rebuild PCTFREE 40 INITRANS 50;

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

解决压力测试期间问题方法如下:

--update HQOA_T_BUSI set busiId= :1 , title= :2 where busiId = :3;

altertable HQOA_T_BUSI pctfree20INITRANS8;

altertable HQOA_T_BUSI move;

alterindex idx_HQOA_T_BUSI rebuildPCTFREE20INITRANS16;

begin

dbms_stats.gather_table_stats(ownname =>'OA_36',

tabname =>'HQOA_T_BUSI',

estimate_percent =>100,

cascade=>true,

degree=>20);

END;

select*from HQOA_T_BUSI;

selectcount(*)from HQOA_T_BUSI;

重新进行压力测试发现:

clip_image010

同样方法处理hqoa_t_sendfile对象后,发现数据库性能正常,而且压力测试也上去了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值