最近informatica在抽取一個表的資料時,經常報“ORA-08103: 對象不再存在”錯誤。當時在網上也沒找到特別好的解決辦法,只能自己分析了下原因,最終解決了這個問題。
先說下背景:
informatica每天淩晨3點多會對一個有幾千萬資料量的表進行抽取操作,但是在到3:40左右的時候,經常會報該錯誤。由於抽取的表的資料是由另外一個ETL抽取而來的,且在3:40左右資料還在抽取,而且該表的資料事先會被truncate掉。
尋找原因:
根據錯誤的提示,我原以為是因為表被drop掉了,但最後發現不是。後來,根據兩邊ETL執行的時間,我猜測是因為我這邊的ETL對該表進行讀取操作時,正好另外的那個ETL將該表truncate掉,導致該錯誤產生。調整了下ETL執行時間,優先保證truncate表的ETL先執行完,然後再執行我這邊的ETL,結果不再報該錯誤,問題解決。
後來在網上查了下,有個寫得不錯:
symptom: Error performing a SELECT statementsymptom: ORA-08103: object no longer existssymptom: Table is being truncated by other sessionsymptom: Analyze table validate structure cascade returns no errorscause: This ORA-08103 occurs on the next block read after the truncate command.The LOCK TABLE IN EXCLUSIVE MODE does not prevent the table from beingSELECTED from. Thus, when the query has started and while this query runsand the truncate occurs, this ORA-08103 may surface on the next block read.This is considered intended behavior.When a TRUNCATE occurs the DATAOBJ# in OBJ$ gets increased by one and thusmay lead to this ORA-08103 'object no longer exists'fix:Possible solutions are:- Use DELETE instead of TRUNCATE- Use SELECT FOR UPDATE as this will try to lock the table