Oracle誤刪表內資料,如何恢復

2021-08-21 13:09:52 字數 1123 閱讀 5287

實際操作中,有時候會誤刪資料,下面是一些恢復資料的方法

/*1.flashback query*/

/*這裡只是查出被刪之前的資料,如果要恢復,則把查詢出來的資料匯出為sql,然後找到原表,重新匯入資料即可*/

--閃回到15分鐘前

select * from orders as of timestamp (systimestamp - interval '15' minute) where ......

--這裡可以使用day、second、month替換minute,例如:

select * from orders as of timestamp(systimestamp - interval '2' day)

--閃回到某個時間點

select * from orders as of timestamp to_timestamp ('01-sep-04 16:18:57.845993', 'dd-mon-rr hh24:mi:ss.ff') where ...

--閃回到兩天前

select * from orders as of timestamp (sysdate - 2) where.........

/*2.flashback drop*/

1.flashback table orders to before drop;

--2.如果源表已經重建,可以使用rename to子句:

flashback table order to before drop rename to order_old_version;

/*3.flashback table*/

--1.首先要啟用行遷移:

alter table order enable row movement;

--2.閃回表到15分鐘前:

flashback table order to timestamp systimestamp - interval '15' minute;

--閃回到某個時間點:

flashback table order to timestamp to_timestamp('2007-09-12 01:15:25 pm','yyyy-mm-dd hh:mi:ss am')

oracle表資料誤刪還原

一 如果是剛剛刪除,那麼有兩方法 首先用show parameter undo 命令檢視當時的資料庫引數undo retention設定。顯示如下 undo management string auto undo retention integer 10800 undo suppress error...

oracle 表資料 誤刪時 資料恢復

通過時間恢復刪除資料 alter table drugusage enable row movement 開啟行遷移 select from drugusage as of timestamp to timestamp 2016 06 02 12 00 47 yyyy mm dd hh24 mi s...

oracle恢復誤刪表

一 表的恢復 對誤刪的表,只要沒有使用purge永久刪除選項,那麼從flash back區恢復回來希望是挺大的。一般步驟有 1 從flash back裡查詢被刪除的表 select from recyclebin 2.執行表的恢復 flashback table tb to before drop,...