加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

flashback off下delete和update表的恢复(flashback query技术)

发布时间:2020-12-15 06:12:17 所属栏目:百科 来源:网络整理
导读:SQL create table emp (id number,name varchar2(100),salary number); Table created. SQL insert into emp values(1,'zhang',100); 1 row created. SQL insert into emp values(2,'jiao',100); 1 row created. SQL commit; Commit complete. SQL alter ses
SQL> create table emp (id number,name varchar2(100),salary number);

Table created.

SQL> insert into emp values(1,'zhang',100);

1 row created.

SQL> insert into emp values(2,'jiao',100);

1 row created.

SQL> commit;

Commit complete.

SQL> alter session set nls_date_format='hh24:mi:ss';

SQL> select sysdate from dual;

SYSDATE
--------
16:04:12

SQL> delete from emp;

2 rows deleted.

SQL> commit;

Commit complete.

SQL> select * from emp;

no rows selected


SQL> select * from emp
? 2? as of timestamp
? 3? to_timestamp('2012-04-15 16:04:12','yyyy-mm-dd hh24:mi:ss');


SQL> insert into emp
? 2? select * from emp
? 3? as of timestamp
? 4?? to_timestamp('2012-04-15 16:04:12','yyyy-mm-dd hh24:mi:ss');

2 rows created.

SQL> commit;

------------------------------------------------------------------------------------------------

update回之前指定列的恢复

update emp e1 set e1.salary=
(select salary from emp
as of timestamp
to_timestamp('2012-04-15 16:04:12','yyyy-mm-dd hh24:mi:ss') e2
?where e1.id=e2.id )

commit;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读