您的位置:首页 > 数据库 > Oracle

oracle误操作删除数据的回滚

2010-09-23 20:37 253 查看
oracle 10G数据闪回的用法:

(1)创建闪回用户查询

登陆sys用户

创建用户

SQL>create user test identified by test;

赋值闪回权限

SQL>grant execute on dbms_flashback to test;

连接test

SQL>conn test/test;

启动行移动功能

SQL>alter table test enable row movement;

(2)创建测试表,插入测试记录

SQL>create table test(id number);

SQL>insert into test values (1);
SQL>insert into test values (2);

SQL>commit;

SQL>delete test;

(3)执行闪回操作

SQL>flashback table test to timestamp to_timestamp('2010-09-23 19:30:30','yyyy-mm-dd hh24:mi:ss');

SQL>select * from test;

ID
----
2

(4)如果执行其他操作

SQL> execute dbms_flashback.disable;

第二种方法参考同事的方法

SELECT * FROM TEST;

select dbms_flashback.get_system_change_number from dual;

查找时间点

select count(*) from test;
delete from test;
commit;
select count(*) from tEST as of scn 11278446510035;

select count(*) from tEST as of scn 11278446510000;

查找上面两个时间点之间的数据
insert into test select * from test as of scn 11278446510000;
select * from test;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: