ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 行级恢复2008-03-28 学习日志

行级恢复2008-03-28 学习日志

原创 Linux操作系统 作者:hxhy 时间:2019-06-19 11:27:04 0 删除 编辑

SQL> host time

SQL> delete from emp where deptno=30;

已删除6行。

SQL> select empno from emp where deptno=30;

未选定行

SQL> commit;

提交完成。

SQL> select empno from emp as timestamp to_timestamp('2008-03-28 16:32:55',
  2  'yyyy-mm-dd hh24:mi:ss') where deptno=30;
select empno from emp as timestamp to_timestamp('2008-03-28 16:32:55',
                      *
第 1 行出现错误:
ORA-00933: SQL 命令未正确结束


SQL> select empno from emp as of timestamp to_timestamp('2008-03-28 16:32:55',
  2  'yyyy-mm-dd hh24:mi:ss') where deptno=30;

     EMPNO                                                                     
----------                                                                     
      7499                                                                     
      7521                                                                     
      7654                                                                     
      7698                                                                     
      7844                                                                     
      7900                                                                     

已选择6行。

SQL> insert into emp
  2  select *  from emp as of timestamp
  3  to_timestamp('2008-03-28 16:32:55','yyyy-mm-dd hh24:mi:ss')
  4  where deptno=30;

已创建6行。

SQL> commit;

提交完成。

SQL> select empno from emp where deptno=30;

     EMPNO                                                                     
----------                                                                     
      7499                                                                     
      7521                                                                     
      7654                                                                     
      7698                                                                     
      7844                                                                     
      7900                                                                     

已选择6行。

SQL> spool off;

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

SQL> host time
当前时间: 17:11:27.60
输入新时间:

SQL> delete from emp where deptno=30;

已删除6行。

SQL> commit;

提交完成。

SQL> select empno from emp where deptno=30;

未选定行

SQL> flashback table emp to timestamp
  2  to_timestamp('2008-03-28 17:11:27','yyyy-mm-dd hh24:mi:ss');
flashback table emp to timestamp
                *
第 1 行出现错误:
ORA-08189: 因为未启用行移动功能, 不能闪回表

 

SQL> alter table emp enable row movement;

表已更改。

SQL> flashback table emp to timestamp
  2  to_timestamp('2008-03-28 17:11:27','yyyy-mm-dd hh24:mi:ss');

闪回完成。

SQL> select empno from emp where deptno=30;

     EMPNO                                                                     
----------                                                                     
      7499                                                                     
      7521                                                                     
      7654                                                                     
      7698                                                                     
      7844                                                                     
      7900                                                                     

已选择6行。

SQL> spool off;

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/50509/viewspace-219106/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2003-06-28

  • 博文量
    27
  • 访问量
    25525