10g的flashback table有如下特性
* 在线操作
* 恢复到指定时间点或者SCN的任何数据.
* 自动恢复相关属性,如索引,触发器等
* 满足分布式的一致性
* 满足数据一致性,所有相关对象将自动一致
语法为:
FLASHBACK TABLE tablename TO TIMESTAMP (JUL-07-2003, 02:33:00)
FLASHBACK TABLE employee TO SCN 123456;
FLASHBACK TABLE tablename TO TIMESTAMP '2003-03-03 12:05:00' ENABLE TRIGGERS;
其中ENABLE TRIGGERS表示触发器恢复之后为enable状态,而默认为disable状态。
----------------------------------------------------------------------------------------------------------------------
查询的语法:
SELECT * FROM t3 AS OF TIMESTAMP
TO_TIMESTAMP('090719082800', 'yymmddhh24miss')
----------------------------------------------------------------------------------------------------------------------
恢复的语法:
1.误删一个表(数据并不会丢失):
create table t3(id number,name varchar2(10),test1 varchar(10),test2 varchar2(10),test3 varchar2(10));
drop table t3;
flashback table t3 to before drop;
2.误删一个表中的数据:
select * from t3;
ID NAME TEST1 TEST2 TEST3
---------- ---------- ---------- ---------- ----------
3 s s s s
1 sf sd sdf s
delete t3;
select * from t3 as of timestamp to_timestamp('090719084751','yymmddhh24miss');
alter table t3 enable row movement;
flashback table t3 to timestamp to_timestamp('090719084751','yymmddhh24miss');