通過閃回查詢和事物查詢恢復小記

2021-05-22 15:13:17 字數 1165 閱讀 3457

1、

sql> select count(*)  from  test order by id;

count(*)

----------

1202、delete from  test where id<50

commit;

3、sql> select dbms_flashback.get_system_change_number from dual;----最好查訊到當前scn,否則有時會出現

ora-30052: invalid lower limit snapshot expression錯誤,sql>alter system set undo_retention=10800 scope=both;

get_system_change_number

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

610896

4、select versions_xid, versions_operation from test versions  between scn 610000 and 610896 order by 2;

versions_xid                 versions_operation

06002e0019010000        d

06002e0019010000        d

5、select xid,commit_scn,commit_timestamp,operation,undo_sql from flashback_transaction_query q where q.xid='06002e0019010000'

6、通過scn閃回,提交的scn為610521,應該閃回到610520

insert into test

select * from test as of scn 610520

where id not in (select id from test);

7、通過時間閃回

insert into test

select * from test as of timestamp to_timestamp('2010-5-24 10:29:15', 'yyyy-mm-dd hh24:mi:ss')

where id not in (select id from test);

commit;

MySQL回閃查詢 閃回查詢(undo sql)

select versions xid,versions operation,versions starttime,versions endtime,versions startscn,versions endscn from site daily report versions between t...

閃回事物查詢

一 閃回事物查詢的先決條件 1 使用者要有 select any transaction 的許可權 2需要undo表空間的增強資訊,用一下的語句開啟undo表空間的增強資訊。alter database add supplemental log data alter database add sup...

Oracle閃回查詢

閃回查詢 查詢在特定時間點存在的所有資料。使用閃回查詢功能,可以執行截止到特定時間的查詢。使用select語句的as of子句,可以指定要檢視其對應資料的時間戳。這在分析資料差異時非常有用。注 timestamp和scn是as of子句的有效選項。update employees set salar...