您好,欢迎访问一九零五行业门户网

SCN FlashBack 闪回常用语句

可以通过函数scn_to_timestamp(10g以后)将其转换回timestamp: select dbms_flashback.get_system_change_number, scn_to_time
可以通过函数scn_to_timestamp(10g以后)将其转换回timestamp:
select dbms_flashback.get_system_change_number, scn_to_timestamp(dbms_flashback.get_system_change_number) from dual;
也可以用函数timestamp_to_scn将一个timestamp转换为scn:
select timestamp_to_scn(systimestamp) as scn from dual;
如果你想把date类型转换成timestamp类型,就使用cast函数。
select cast(sysdate as timestamp) from dual;
--恢复到几分钟前
select t.*, t.rowid from ar_mid_acap as of timestamp sysdate - 5 / 1440 t;
--恢复到具体的某个时间点
select *
  from ar_mid_acap as of scn timestamp_to_scn(to_date('2012-4-25', 'yyyy-mm-dd hh24:mi:ss'));
--两个时间点间的变化信息
select v_id, va, versions_startscn, versions_endscn, versions_operation
  from t_fb_test versions between scn 12372466 and 12372538
 order by 1;
--恢复语句undo
select xid, commit_scn, commit_timestamp, operation, undo_sql
  from flashback_transaction_query q
 where q.xid in
       (select versions_xid
          from t_fb_test versions between scn 23413946 and 23413959);
--恢复表
 flashback table goodsinfo1 to before drop;

其它类似信息

推荐信息