Oracle数据回滚
Oracle数据回滚
示例
SQL> set linesize 100
SQL> column col1 format a10
SQL> select * from test;
COL1 ID
---------- ----------
col1 1
col2 2
col3 3
col4 4
SQL> update test set id = 2;
已更新4行。
SQL> commit;
提交完成。
SQL> select * from test;
COL1 ID
---------- ----------
col1 2
col2 2
col3 2
col4 2
SQL>
- 查询update语句执行的时间节点 ;
select t.FIRST_LOAD_TIME, t.SQL_TEXT from v$sqlarea t where to_char(t.FIRST_LOAD_TIME) > '2021-03-19/17:00:00' order by t.FIRST_LOAD_TIME desc;
2. 开启表的行迁移
alter table test enable row movement;
- 回滚表数据到目标节点
flashback table test to timestamp to_timestamp('20210319 17:00:02','YYYYMMDD HH24:MI:SS');
- 查询回滚结果
SQL> select * from test;
COL1 ID
---------- ----------
col1 1
col2 2
col3 3
col4 4
SQL>