这个功能和flashback on/off 以及recyclebin on/off没有关系
**********************************************************************
flashback query是基于undo表空间的闪回,与之相关的参数如下:
SQL> show parameter undo
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_management string AUTO
undo_retention integer 900
undo_tablespace string UNDOTBS1
undo_management:undo管理方式分自动auto和手动manul两种,默认为auto。
undo_retention:此参数表示,如果undo表空间中的空间充足,那么undo数据至少为保留900秒;
undo_tablespace:指定undo表空间
注意:如果undo表空间为auto管理方式,那么当undo表空间中的空间不足的时候,还是会覆盖保留区内的undo数据,也就说这种情况下
不能保证undo数据保留900秒,900秒内不一定能恢复dml操作。特殊情况下可以用下面命令长期保留undo数据,但为影响undo空间和dml操作
**********************************************************************
备注:TIMESTAMP (SYSTIMESTAMP - INTERVAL '1' DAY)指查询距当前时间一天以
前的时间点的数据,如果我们要查询一小时以前的,那么需要将DAY 替换成HOUR 即可,
查询10 分钟以前的将'1' DAY 替换'10' MINUTE。
select dbms_flashback.get_system_change_number from dual;
select * from t1 as of timestamp (systimestamp - interval '6' minute);
select * from t4 AS OF TIMESTAMP (SYSTIMESTAMP - INTERVAL '6' MINUTE) where deptno='30';
select * from t1 as of scn 6041836267877;
flashback table t1 to timestamp (systimestamp - interval '6' minute);
flashback table t1 to scn '1054345';
----------------------------------------------------------------------
select to_date(sysdate,'YYYY-MM-DD HH24:MI:SS') sys_date from dual; --查看时间戳
select dbms_flashback.get_system_change_number from dual; --查看scn
grant flashback any table to scott; --赋予scott flashback table权限
alter table t1 enable row movement; --开启行移动功能
flashback table xyc_t1 to scn '1054345'; --基于scn闪回表