Oracle数据update后回滚

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>
  1. 查询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;
  1. 回滚表数据到目标节点
flashback table test to timestamp to_timestamp('20210319 17:00:02','YYYYMMDD HH24:MI:SS');
  1. 查询回滚结果
SQL> select * from test;

COL1               ID
---------- ----------
col1                1
col2                2
col3                3
col4                4

SQL>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值