天天看點

ORA-14450: attempt to access a transactional temp table already in use

在oracle資料中修改會話級臨時表時,有可能會遇到ora-14550錯誤,那麼為什麼會話級全局臨時表會報ora-14450錯誤呢,如下所示,我們先從一個小小案例入手:

案例1:

如上所示,修改會話級臨時表時遇到了ora-14450錯誤,那麼有哪些解決方法呢? 這時需要斷開會話或執行truncate語句:

如下所示,我們模拟一個會話在操作臨時表temp_test, 另外一個會話準備修改它,如下所示(實際場景可能更複雜,可能涉及多個會話而不是僅僅兩個會話)

會話1:

會話2::

那麼此時,會話1是其它使用者登入的。比如應用程式等,你不可能要求所有會話都去執行truncate操作,這個時候該怎麼處理呢?

此時你可以使用下面步驟解決這個問題。

step 1、以sys或system登入資料庫,先從dba_objects中查詢到該表的object_id:

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

step 3、通過下面sql找到對應的會話并生成kill session的執行語句

step 4、檢視會話狀态,并執行alter system kill session語句殺掉這些程序:

具體操作步驟,如下截圖所示: 

ORA-14450: attempt to access a transactional temp table already in use

原因: 檢視ora-14450的錯誤,你可以看到如下資訊:

[oracle@oracle-server ~]$ oerr ora 14450

14450, 00000, "attempt to access a transactional temp table already in use"

// *cause:  an attempt was made to access a transactional temporary table that

//          has been already populated by a concurrent transaction of the same

//          session.

// *action: do not attempt to access the temporary table until the

//          concurrent transaction has committed or aborted.