oracle ORA-14452錯誤處理例程

聽海★藍心夢發表於2009-03-10

今天,同事突然讓我建立一個索引,說他建立不上。我拿過來一看,語句很 簡單:create index IDX_AQ_NEFILTER on AQ_NEFILTER (INT_ID);。可是一執行就報錯。錯誤資訊:

ORA-14452: attempt to create, alter or drop an index on temporary table already in use

經查,該錯誤的解釋為:

Cause: An attempt was made to create, alter or drop an index on temporary table which is already in use.

Action: All the sessions using the session-specific temporary table have to truncate table and all the transactions using transaction specific temporary table have to end their transactions.

因為表AQ_NEFILTER 為臨時表,而且有其他session正在使用。

處理步驟:

1、先從user_objects中查詢到該表的object_id:

select object_id from user_objects where object_name=upper('aq_nefilter');

2、根據查到的object_id知道使用該表的session:

select * from v$lock where id1=&object_id;

3、在從v$session檢視中查到該session的SID和SERIAL#:

select * from v$session where sid=181;

4、殺掉這些程式:

alter system kill session SID,SERIAL#;

5、重新建立索引(4,5兩步一定要快,否則,剛結束一個session,又有新的session使用該表了):

create index IDX_AQ_NEFILTER on AQ_NEFILTER (INT_ID);

至此,已經建立成功。不過,這個過程中我有個疑問,v$lock 檢視中的id1欄位是什麼意思?和user_objects 檢視中的object_id欄位是對應的麼?哪位看過了給解釋下?

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/751371/viewspace-566584/,如需轉載,請註明出處,否則將追究法律責任。

相關文章