天天看點

ITL争用--oracle 已經棄用了MAXTRANS 參數。physical_attributes_clause:

在建立一個表的時候如若未指定任何(physical_attributes_clause

 )參數:

If you omit this clause, then Oracle Database sets 

PCTFREE

 to 10, 

PCTUSED

 to 40, and 

INITRANS

 to 1.

oracle 已經棄用了MAXTRANS 參數,該參數預設是自動調節的,最大值為255.

在資料庫遇見enq: TX - allocate ITL entry:

解決方法

  系統中存在少量的ITL等待是正常的,隻有當其對系統造成了影響(如awr report中,在top 5 events中發現該事件),或者對應用造成了直接影響(如死鎖,再如發現某一會話存在大量等待ITL),我們才需要采取相應手段進行處理。針對導緻ITL等待不同原因,我們要采取不同的手段來處理。

  INITRANS不足

  這種情況隻會出現的表的資料塊上,如我們上述的例子:資料塊上的ITL數量并沒有達到MAX TRANS的限制,可用空間小于24位元組。發生這種情況的表通常會被經常UPDATE,進而造成預留白間(PCTFREE)被填滿。如果我們發現這類ITL等待對系統已經造成影響,可以通過增加表的INITRANS或者PCTFREE來解決(視該表上的并發事務量而定,通常,如果并發量高,建議優先增加INITRANS,反之,則優先考慮增加PCTFREE)。

  要注意的一點是,如果是使用ALTER TABLE的方式修改這2個參數的話,隻會影響新的資料塊,而不會改變已有資料的資料塊——要做的這一點,需要将資料導出/導入、重建表。

  MAXTRANS不足

  這一情況是由高并發引起的:同一資料塊上的事務量已經超出了其實際允許的ITL數(如前所述,ITL slot所占空間不能超過資料塊大小的一半,如8K的限制為169)。是以,要解決這類問題就需要從應用着手,減少事務的并發量;長事務,在保證資料完整性的前提下,增加commit的頻率,修改為短事務,減少資源占用事件。而對于OLAP系統來說(例如,其存在高并發量的資料錄入子產品),可以考慮增大資料塊大小。

  遞歸事務ITL争用

  這一類等待通常是系統存在并發事務頻繁插入、修改資料導緻,其往往伴随"enq: TX - index contention"事件出現。根本解決方法就是要減少索引分裂,如使用大資料塊、減少索引中效率低、使用率低的字段等。

physical_attributes_clause:

INITRANS integer:

Specify the initial number of concurrent transaction entries allocated within each data block allocated to the database object. This value can range from 1 to 255 and defaults to 1, with the following exceptions:

The default INITRANS value for a cluster is 2 or the default INITRANS value of the tablespace in which the cluster resides, whichever is greater.

The default value for an index is 2.

In general, you should not change the INITRANS value from its default.

Each transaction that updates a block requires a transaction entry in the block. This parameter ensures that a minimum number of concurrent transactions can update the block and helps avoid the overhead of dynamically allocating a transaction entry.

The INITRANS parameter serves the same purpose in the statements that create and alter tables, partitions, clusters, indexes, materialized views, and materialized view logs.

MAXTRANS Parameter:

MAXTRANS  《=========已經廢棄的了該參數。

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.

内容摘自:

SQL Language Reference---

8 Common SQL DDL Clauses