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

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博客 ” ,链接:http://blog.itpub.net/50509/viewspace-219106/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/50509/viewspace-219106/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值