oracle閃回技術恢復誤運算元據

2021-06-21 08:08:46 字數 1845 閱讀 3225

運算元據庫時,有時會不小心誤操作,比如執行了一些有問題的sql,導致破壞了資料,需要恢復;或者有時場景需要,要把整個表恢復到某個時間段。oracle中可以用閃回技術實現。

1.原資料表的資料

做增刪改操作

對jf_test2表做增刪改後:select

確定誤操作的大致時間點,取出該時間點

jf_test2

的資料

create

table

jf_test2temp as

select

* from

jf_test2

asof

timestamp

(to_date(

'2014-04-01 15:03:00'

, 'yyyy-mm-dd hh24:mi:ss'

));

查詢jf_test2temp:

4.恢復資料 --

恢復誤update

update

jf_test2 t

sett.name = (

select

tt.name

from

jf_test2temp tt

where

tt.code = t.code)

where

exists

(select

* from

jf_test2temp ttt

where

ttt.code = t.code);

--恢復誤delete

insert

into

jf_test2(

code

,name)

select

tt.code,tt.name

from

jf_test2temp tt

where

notexists

(select

* from

jf_test2 t

where

t.code = tt.code);

--恢復誤insert

delete

from

jf_test2 t

where

notexists

(select

* from

jf_test2temp tt

where

tt.code = t.code);

再次查詢

jf_test2

看看:select

利用Oracle閃回技術恢復誤運算元據

在操作oracle的過程中,有的時候會誤操作表資料,例如更新或者刪除,如何找到誤操作前的資料呢?oracle提供了閃回技術,可以訪問過去某一時間的資料 如果時間太長或者操作過於頻繁有可能找不到 舉例,建立表test sj salary,初始化指令碼 create table test sj sala...

oracle閃回技術

1,閃回資料庫到之前某時間點 在安裝時需要開放閃回功能 不支援表空間刪除 select name from v database 看是否開啟閃回功能 select flashback on,name from v database select name from v bgprocess where...

oracle閃回技術

查詢某一時刻資料庫中資料狀態語句 select from abc as of timestamp to timestamp 2015 08 24 10 31 00 yyyy mm dd hh24 mi ss 閃回dml語句 flashback table abc to timestamp to ti...