online rebuild index异常终止遇到ORA-08104

2014-11-24 18:29:49 · 作者: · 浏览: 0

create index idx_p_merchant_detail_id on D_ORDER_DETAIL (merchant_detail_id) Online;


创建好长时间,没有反映;然后取消,结果删除索引的时候,报如下的错误:

错误:ORA-08104: this index object 67420 is being online built or rebuilt

通过 ONLINE 参数创建索引(或者重建索引), 如果进程被突然终止,或者是手工 CTRL+C 取消该操作,
在非常个别的时候,麻烦来了。重新创建索引,会告诉你该索引已经存在,drop index ,会告诉你该索
引被锁,或者是 ORA-08104(this index object xxxxx is being online built or rebuilt) 错误。



异常终止的情况下,可以发现ind$关于该索引的状态还是online rebuild的:

SQL> select obj#,flags from ind$ where obj#=67420;
OBJ# FLAGS
---------- ----------
67420 514

Flags字段的说明可以在ind$的sql.bsq脚本中找到:

/* mutable flags: anything permanent should go into property */
/* unusable (dls) : 0x01 */
/* analyzed : 0x02 */
/* no logging : 0x04 */
/* index is currently being built : 0x08 */
/* index creation was incomplete : 0x10 */
/* key compression enabled : 0x20 */
/* user-specified stats : 0x40 */
/* secondary index on IOT : 0x80 */
/* index is being online built : 0x100 */
/* index is being online rebuilt : 0x200 */
/* index is disabled : 0x400 */
/* global stats : 0x800 */
/* fake index(internal) : 0x1000 */
/* index on UROWID column(s) : 0x2000 */
/* index with large key : 0x4000 */
/* move partitioned rows in base table : 0x8000 */
/* index usage monitoring enabled : 0x10000 */



514=0×202,表示该索引状态为index is being online rebuilt : 0×200 + analyzed : 0×02

在SMON完成清理动作后,再次查询索引状态已经恢复正常:

SQL> select obj#,flags from ind$ where obj#=67420;
OBJ# FLAGS
---------- ----------
67420 2

清理完后,可以在alert.log中看到如下记录:

User:,time:20071209 03:12:09,program:oracle@db1
(SMON),IP:,object:SYS_JOURNAL_67420,DDL: drop table "TAOBAO"."SYS_JOURNAL_67420"