oracle資料誤刪後恢復

2021-05-25 06:49:59 字數 1695 閱讀 3905

sql>select count(*) from t1;

count(*)

----------

9318

2.誤刪除所有記錄

並且提交更改。

sql>delete from t1;

9318 rows deleted.

sql>commit;

commit complete.

sql>select count(*) from t1;

count(*)

----------

03.獲得當前scn

如果能夠確切知道刪除之前scn最好,如果不知道,可以進行閃回查詢嘗試.

sql>select dbms_flashback.get_system_change_number from dual;

get_system_change_number

------------------------

10671006

sql>select count(*) from t1 as of scn 10671000;

count(*)

----------

0sql>select count(*) from t1 as of scn 10670000;

count(*)

----------

9318

我們看到在scn=10670000時,資料都在。

4.恢復資料.

sql>insert into t1 select * from t1 as of scn 10670000;

9318 rows created.

sql>commit;

commit complete.

sql>select count(*) from t1;

count(*)

----------

9318

文章2誤刪資料後的還原

select timestamp_to_scn(to_timestamp('2009-03-13 09:00:00','yyyy-mm-dd hh:mi:ss')) from dual;

結果:13526973

將刪除時間轉換為scn

select * from reportinfo

as of scn 13526973

將reportinfo表中的scn點的資料取出

然後可以根據這個資料進行還原操作

create table reporttest as select * from reportinfo where 1=0;

insert into reporttest select * from reportinfo as of scn 13526973;

--上面兩句應該可以合成一句

--create table reporttest as select * from reportinfo as of scn 13526973;

這是reporttest表中就是scn點的reportinfo資料.處理即可

select * from serviceinfotable--你操作的那張表 

as of timestamp to_timestamp('2011-05-09 15:04:54','yyyy-mm-dd hh24:mi:ss')

where servicetype='3' and extension3 like '%371%'

oracle 誤刪資料後恢復資料

閃回 根據時間恢復表資料 檢視表資料 檢視某個時間點之前的表資料 select from 表名 as of timestamp to timestamp 2021 03 18 10 12 11 yyyy mm dd hh24 mi ss 若沒有資料 可時間繼續提前查詢 flashback table...

ORACLE誤刪資料恢復

有很多原因導致了資料記錄的誤刪,怎樣恢復誤刪的記錄呢?先來看看這個概念 scn 系統改變號 它的英文全拼為 system change number 它是資料庫中非常重要的乙個資料結構。scn提供了oracle的內部時鐘機制,可被看作邏輯時鐘,這對於恢復操作是至關重要的 注釋 oracle 僅根據 ...

oracle誤刪資料恢復

oracle誤刪資料恢復 scn 系統改變號 它的英文全拼為 system change number 它是資料庫中非常重要的乙個資料結構。scn提供了oracle的內部時鐘機制,可被看作邏輯時鐘,這對於恢復操作是至關重要的 注釋 oracle 僅根據 scn 執行恢復。它定義了資料庫在某個確切時刻...