當我們對索引進行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<=:B2 AND LDATE<=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<=:B2 AND LDATE<=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<=:B2 AND LDATE<=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