首页 > Linux操作系统 > Linux操作系统 > 数据库闪回技术1--闪回DML
A、闪回delete
1、查看闪回的时间
Show parameter undo;该参数undo_retention 设置为 900秒
SQL>select name,value from V$parameter where name='db_flashback_retention_target';
NAME VALUE
db_flashback_retention_target 1440
1、创建表;记录时间戳 如图

2、删除表记录
SQL> delete from userxu where user_name='林艳红';
1 row deleted
SQL> commit;
Commit complete
SQL> select * from userxu where user_name='林艳红';
空记录
Select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'), to_char(DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER) AS SCN from dual;
TO_CHAR(SYSDATE,'YYYY-MM-DDHH2 SCN
2012-01-30 10:12:01 15910484096
3、闪回表delete
SQL> flashback table userxu to timestamp to_timestamp('2012-01-30 10:10:00','yyyy-mm-dd hh24:mi:ss');
SQL> alter table userxu enable row movement;
Table altered
将该表闪回到某个时间段。
SQL> flashback table userxu to timestamp to_timestamp('2012-01-30 10:00:00','yyyy-mm-dd hh24:mi:ss');
Done
SQL> select count(*) from userxu;
COUNT(*)
----------
5848
SQL> flashback table userxu to timestamp to_timestamp('2012-01-30 09:53:00','yyyy-mm-dd hh24:mi:ss');
Done
SQL> select count(*) from userxu;
COUNT(*)
----------
5849
SQL> select * from userxu where user_name='林艳红';
2007-11-01 staticpwd 0001A210000000030KKG 0 simpchn N 0001 2010-11-04 0 2010-11-04 09:16:47 064005 林艳红 X20101104a100122 jhjkeldbfknejblp update
闪回成功。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/7377813/viewspace-717405/ ,如需转载,请注明出处,否则将追究法律责任。