oracle的flashback

1、授予bankuser用户闪回权限
grant flashback any table to bankuser;

2、恢复刚删除的数据
delete from emp where ename='fork';

select ft.start_timestamp,
       ft.commit_timestamp,
       ft.logon_user,
       ft.operation,
       ft.table_name,
       ft.table_owner,
       ft.undo_sql
  from flashback_transaction_query ft
 where table_name = 'EMP';

start_timestamp:执行这条sql语句的时间
commit_timestamp:提交这条sql语句的时间
logon_user:登录数据库的用户
operation:进行的操作(增删改)
table_name:操作表的名字
table_owner:表的拥有者
undo_sql:恢复的sql语句

复制undo_sql语句到sql窗口中执行就可以恢复了

3、恢复数据到某个时间点
恢复前查看所恢复的时间点数据是否正确:
select * from emp as of timestamp to_timestamp('2014-3-8 14:00:00','yyyy-mm-dd hh24:mi:ss');
恢复数据:
alter table emp enable row movement;
flashback table emp to timestamp to_timestamp('2014-3-8 14:00:00','yyyy-mm-dd hh24:mi:ss');

4、oracle数据库可以会恢复到什么时候的数据
要看undo_retention参数
show parameter undo_retention
默认为900秒

5、恢复删除的表
drop table emp;
flashback table emp to before drop;

6、如何知道哪些表可以恢复
 select * from user_recyclebin order by droptime desc;
或者 select * from recyclebin order by droptime desc;






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

转载于:http://blog.itpub.net/29489498/viewspace-1103628/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值