1. 程式人生 > >ORACLE將表中的資料恢復到某一個時間點

ORACLE將表中的資料恢復到某一個時間點

執行如下SQL將test_temp表中的資料恢復到 2011 04 29  11:06:00
注意,這裡一定要先刪除全部資料,否則可能會導致資料重複或者新建一個表結構和test_temp結構相同的表,把資料匯入到新表中
delete from test_temp;
insert into test_temp
  select *
    from test_temp as of timestamp to_timestamp('20110429 11:06:00', 'yyyymmdd HH:mi:ss')
commit;

24小時的
  select *
    from cm_custom_sort as of timestamp to_timestamp('20160808 16:40:01', 'yyyymmdd hh24:mi:ss')

附:truncate後的資料是無法恢復的
truncate table test_temp;