---
title: "oracle 10 G R2  rebuild index online  bug?"
author: "winzenghua"
date: "2007-12-17T18:26:00Z"
tags: []
slug: "oracle-10-g-r2-rebuild-index-online-bug"
draft: false
lastmod: "2007-12-17T18:26:00Z"
id: 987916
url: "https://java4gis.iteye.com/blog/987916"
---

当我们对索引进行rebuild时,如果不加online选项,oracle则直接读取原索引的数据;当我们添加online选项时,oracle是直接扫描表中的数据,那如何维护索引段数据的一致性呢?就是从引开始创建到索引创建完成这段时间的数据改变...

从索引开始rebuild online开始的那一刻起,oracle会先创建一个SYS\_JOURNAL\_xxx的系统临时日志表,结构类似于mlog$\_表,通过内部触发器,记录了开始rebuild索引时表上所发生的改变的记录,当索引已经创建好之后,新数据将直接写入索引,只需要把SYS\_JOURNAL\_xxx日志表中的改变维护到索引中即可.  
当我们rebuild index online失败后，smon进程会清除sys\_journal\_xxx(xxx是object\_id)以及其它的不一致的东西，在smon清除它们之前，是不能再进行rebuild index online的，如果要清除它们，需要执行dbms\_repare包的online\_index\_clean过程来处理...

在9206,9207,10.2.0.1中smon不会很快地清除index rebuild online失败所带来的对象，在9208,10.2.0.2,11g中这个bug才被fixed.所以在9206,9207,10.2.0.1这些版本中，当我们对大的索引进行index rebuild online时，不要随意地中断rebuild index online操作，否则smon可能需要很久才能清除临时对象。。。

试了看后 一个移数据的过程报错

\*\** 2007-12-15 00:49:06.353  
ksedmp: internal or fatal error  
Current SQL statement for this session:  
DELETE FROM SMS\_SENDINFO WHERE REQID&lt;=:B2 AND LDATE&lt;=TO\_DATE(:B1 ,'yyyy-mm-dd HH24:MI:SS')  
\----- PL/SQL Call Stack -----  
object line object  
handle number name  
0x6fd95924 56 procedure SMS.PRO\_BAK\_SENDINFO  
0x65ce87f0 1 anonymous block

\*\** 2007-12-16 00:05:54.978  
ksedmp: internal or fatal error  
Current SQL statement for this session:  
DELETE FROM SMS\_SENDINFO WHERE REQID&lt;=:B2 AND LDATE&lt;=TO\_DATE(:B1 ,'yyyy-mm-dd HH24:MI:SS')  
\----- PL/SQL Call Stack -----  
object line object  
handle number name  
0x7c94cec8 56 procedure SMS.PRO\_BAK\_SENDINFO  
0x6b439074 1 anonymous block

\*\** 2007-12-17 00:04:09.323  
ksedmp: internal or fatal error  
Current SQL statement for this session:  
DELETE FROM SMS\_SENDINFO WHERE REQID&lt;=:B2 AND LDATE&lt;=TO\_DATE(:B1 ,'yyyy-mm-dd HH24:MI:SS')  
\----- PL/SQL Call Stack -----  
object line object  
handle number name  
0x6f3bf314 56 procedure SMS.PRO\_BAK\_SENDINFO  
0x6fe5595c 1 anonymous block

检查表跟索引之间关联性

analyze table sms\_sendinfo validate structure cascade

ORA-01499: table/index cross reference failure - see trace file

ORA-08102: index key not found, obj# 51692, file 6, block 153602 (2)  
IND\_MSGID\_ROUTEID\_TPHONE