Oracle 11gR2上遇到blocking txn id for DDL等待事件

本文是原创文章,转载请注明出处:

在最近处理的一个案例(11.2.0.4版本的oracle db)中,遇到了blocking txn id for DDL 这个等待事件。

下面来说一下当时的操作:

create index idx_tab_1 on table_name (column_name) tablespace xxx online;

如上建立索引的操作用了17分钟零7秒才完成。

之后我生成该时间段的awr报告,,截取top10 等待事件如下:

blocking txn id for DDL 的wait time是1023.1秒 ,17分钟零7秒 =1027秒,也就是说,当时该create index语句的绝大多数时间都在等待。

后来又生成了该时间段的ash报告,在ash报告中,也能清楚的看到 create index操作的等待事件是blocking txn id for DDL,如下:

在mos文章Alter Table Add Column Command Hangs With Wait Event ‘blocking txn id for DDL’ (文档 ID 1553725.1)中,清楚的说明了该等待事件:

原文如下:

DDL commands require exclusive locks on internal structures. If these locks are not available, the commands return with an "ORA-00054: resource busy" error message.On Oracle 11.2 instead of ora-54, the ALTER TABLE statement will not error out immediately. Instead, it waits indefinitely.Prior to 11g, if these locks are not available, the DDL command will fail with an "ORA-00054: resource busy" error message.

翻译如下:

DDL命令需要在内部结构上的排他锁。如果这些锁不能获得,DDL命令会失败,并返回"ORA-00054: resource busy" 错误信息。

在Oracle 11.2中,取代了ora-54,alter table语句 不会立即返回错误,而是会无限期的等待。在11g之前,如果这些锁不能获得,DDL命令会失败,并返回"ORA-00054: resource busy" 错误信息。

近朱者赤,近墨者黑

Oracle 11gR2上遇到blocking txn id for DDL等待事件

相关文章:

你感兴趣的文章:

标签云: