Oracle Online 创建索引失败, ORA-08104

http://space.zdnet.com.cn/html/81/289381-1143194.html

Oracle Online 创建索引失败, ORA-08104

 

通过 ONLINE 参数创建索引(或者重建索引), 如果进程被突然终止,或者是手工 CTRL+C 取消该操作, 在非常个别的时候,麻烦来了。重新创建索引,会告诉你该索引已经存在,drop index ,会告诉你该索引被锁,或者是 ORA-08104(this index object xxxxx is being online built or rebuilt) 错误。该过程失败之前创建的一些临时对象由 SMON 负责清除,糟糕的是, SMON 可能会不作为--我在 9i 上观察是 2 个小时(周期?)才清除掉。

如果是一个比较繁忙的 OLTP 系统, 并且是要维护单列索引,那么风险真的是很大的。在 SMON 清除这些临时对象之前,没有办法在该列上建立新的索引。服务器能撑住么?

在 10g 版本, Oracle 的 DBMS_REPARE 包新增了: online_index_clean ,能够手工进行清除:

dbms_repair.online_index_clean(
object_id     IN BINARY_INTEGER DEFAULT ALL_INDEX_ID,
wait_for_lock IN BINARY_INTEGER DEFAULT LOCK_WAIT)
RETURN BOOLEAN;

谢中辉说这是一个 Bug,经过仔细查看 Metalink ,发现很多文档都说的不够准确--10g 的功能,Oracle 还让 9i 的用户去用呢,很不幸,我也上当了。

非常繁忙的一天.

--EOF--

 

 

http://space.itpub.net/?uid-471666-action-viewspace-itemid-118605

ora-08104 -- 解决

ora-08104 The index is being created or rebuild or waited for recovering from the online (re)build.

alter index index_name rebulid online ;

kill掉session后。
drop index index_name ;
就是提示:ora-08104 ;
drop table table_name ;-- 索引所在的表
就是提示:ora-08104 ;

drop table SYS_JOURNAL_[objid];

truncate table table_name; -- 要做好备份。

drop index index_name ;
就是提示:ora-08104 ; (看到ifree的帖子说他truncte后,就可以drop index 了。我在这里不行)

之后select * from tab_name , 就出现600错误了。越搞越复杂了。
ORA-00600: 内部错误代码,参数: [kkdlfjou_1], [], [], [], [], [], [], []


解决办法:
重建临时表空间

step1 : 为临时表空间添加一个临时文件
ALTER TABLESPACE temp ADD TEMPFILE 'xxx' SIZE 1024m ;
step2 : drop 原来的临时文件
alter database tempfile 'xxx' drop including datafiles

这时在alert.log 中会出现无法删除文件os文件的错误。但是在数据库中已经删除的临时文件。(估计需要重启数据库才能删除了。所以metalink说需要shutdown oracle ,这样才能真正解决问题。)
ORA-01258: 无法删除临时文件 xxxx
ORA-27056: skgfrdel: 无法删除文件
OSD-04024: 无法删除文件。
O/S-Error: (OS 32) 进程无法访问文件,因为另一个程序正在使用此文件。

然后在执行 drop index index_name ; 就没有问题了。

参考:http://www.itpub.net/209621,2.html
http://www.itpub.net/viewthread.php?tid=450020&extra=&page=2

 

DBA备忘录:Online rebuild index遭遇ORA-08104

http://www.ningoo.net/html/2007/dba_memo_online_rebuild_index_encounter_ora-08104.html

 

 

在online rebuild index的过程中,如果中途异常终止(比如按ctrl+c强行退出),运气不好的话,可能会遇到问题,在你想重新rebuild index(或者drop,analyze)的时候,报错:

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

这是由于在异常终止online rebuild操作的时候,oracle没来得及清理相应的临时段和标志位,系统认为online rebuild操作还在进行造成的。在Oracle10g之前,对于这种情况没有太好的办法,只有等SMON进程来进行清理了。网上有说上重启可以解决,有说直接update系统表ind$的,对于不能停机的产品库来说,这些都是不可取的方案。重启不现实,修改系统表更是DBA的大忌。Oracle10g则可以使用dbms_repair.online_index_clean手工清理(metalink的说法,9i打了Bug 3805539的patch的话也能用该过程了)。所以,对于大索引的online rebuild,不要轻易中止。否则可能要等上相当一段时间SMON才能完成清理工作,清理完后,可以在alert.log中看到如下记录:

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

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

SQL> select obj#,flags from ind$ where obj#=67420;

      OBJ#      FLAGS
---------- ----------
     67420        514

Flag字段的说明可以在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

Metalink相关参考:

Note:375856.1
Note:351585.1
Bug 4364202
Bug 3805539
Bug 2702410

转载于:https://www.cnblogs.com/rootq/archive/2009/02/05/1384800.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值