ORA-08102 錯誤解決

來源:互聯網
上載者:User

ORA-08102 錯誤解決

今天兩次遇到ORA-08102的錯誤,在刪除表的資料時

在執行如下語句時:

delete from tb_ware w where w.issue like '%04%';

遇到下面的錯;

ORA-08102:index key not found,obj#57848,file 6, block 6324(2)

*******************************************************************************
/ *Cause: Internal error: possible inconsistency in index

// *Action: Send trace file to your customer support representative, along
// with information on reproducing the error

*******************************************************************************

ORA-08102這種錯誤說明索引或表出現了資料不一致的,索引上記錄的索引值和表裡的資料不一致,引起訪問失敗,一般重建下索引就可以解決


解決方案一:

SELECT owner, object_name, object_type
FROM Dba_Objects
WHERE object_id IN (57848);

可以查出object_name的名字,發現是表TB_WARE的索引,然後重建索引

alter index PK_TB_WARE rebuild online; (記得要用rebuild online ,因為他會重新讀表來建立索引,而rebuild可能會讀取原先的索引段而不會去讀表)

注意,這個時候千萬不要人為終止,如果你真的那樣的話你會遇到ora-08104

如果還不能解決,就刪除重新建立

select index_name,column_name from all_ind_columns
where index_name='PK_TB_WARE';


drop index PK_TB_WARE;

create index PK_TB_WARE on tb_ware(id);

解決方案二:

analyze table t validate structure cascade

檢查表裡的行資料的完全性,並檢查表或者索引的結構,並把分析過的結果寫入INDEX_STATS 資料字典中

這個方法我沒有嘗試,我嘗試再讓問題重現,嘗試好幾次也沒有在出現

---------------------------------

現在回到我的問題上,我在rebuild online一個索引後,它又提示下一個索引有問題,我索性就把這個表所有的索引都rebuild online

查出這個表的索引


select * from user_indexes t where t.table_name= upper('tb_ware')

組裝成下面的語句執行:

alter index PK_TB_WARE rebuild online;
alter index AK_TB_WARE rebuild online;
alter index IDX_TB_WARE_PRINTSTATE rebuild online;
alter index IDX_WARE_END_TIME rebuild online;
alter index IDX_WARE_LOTTERY_ID rebuild online;
alter index IDX_WARE_LOTTERY_STATE rebuild online;
alter index IDX_WARE_TEAM_NAME rebuild online;


再次使用這個表,或到alert.log裡就沒有ORA-08102的錯誤了

---end----

Oracle 單一實例 從32位 遷移到 64位 方法 

在CentOS 6.4下安裝Oracle 11gR2(x64)

Oracle 11gR2 在VMWare虛擬機器中安裝步驟

Debian 下 安裝 Oracle 11g XE R2

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.