天天看點

ORACLE FLASHBACK TABLE 的一個有趣問題

大家都知道oracle 10g新增了flashback特性,其中flashback table用來對誤删的表進行修複。但是今天卻發現了flashback table的一個有趣問題,請看下面慢慢道來:下面我用一個例子來說明我的遇到的有趣的問題,歡迎大家探讨。

出現ora-38305錯誤,起初我以為是資源回收筒機制參數off引起的,oracle10g起,引入了資源回收筒的機制,将drop掉的資料表儲存在資源回收筒中。當發現誤删除的時候,可以通過資源回收筒回收資料表。資源回收筒機制類似于我們在windows系統上的資源回收筒。在windows中,當我們選擇删除一個檔案時,本質上并沒有将檔案從硬碟上删除,隻是将檔案以一種形式改名,這樣就能從資源回收筒中看到。于是我檢視了recyclebin參數

ORACLE FLASHBACK TABLE 的一個有趣問題

奇怪的是資源回收筒參數是開啟的,sql> show recyclebin; 也看不到删除的表。這到底是咋回事呢?折騰了很久。後來修改了建立表的表空間,竟然一切都ok

如果不指定建立表的表空間,那麼它會使用預設的表空間system,你可以通過select

tablespace_name from user_tables where

table_name='test'檢視。後來我有多次重複了這個實驗,結果都是如此,開來在表空間system下是無法使用flashback

table特性的,很有趣的,後來查了下資料才知道: you

cannot 'flashback table to before drop' a table which has been created

in the system tablespace. the table is sent to the recyclebin only if it

existed in some other tablespace other than system tablespace and that

tablespace must be locally managed.看來oracle限制了在表空間system下使用資源回收筒機制,不知道oracle為什麼有這限制。

上一篇: Xcode調試LLDB