`
java-mans
  • 浏览: 11420345 次
文章分类
社区版块
存档分类
最新评论

利用Flashback轻松找回误删除数据

 
阅读更多
测试:
1.首先创建一张表TEST
create table test (name int)
2.插入两条数据:
insert into test values (1);
insert into test values (1);
3.对表启动移动行

ALTERTABLE table ENABLE ROW MOVEMENT;

4.删除表:

drop table test

5.在回收站查询表:

SHOWRECYCLEBIN;

或者

SELECTobject_name AS recycle_name, original_name, type

FROMrecyclebin;

这个时候我们在回收站还是可以看到表test的,Flashback Drop就是从这里讲数据恢复的。

6.恢复数据:

FLASHBACK table to test to before drop;

7.查询数据:

select * from test

这时候就可以看到数据已经都还原了。非常好的功能,不需要像SQL Server那样从备份中还原。

Flashbackup drop有一些条件限制:

Objects must meet the following prerequisites to be eligible for retrieval from the
recycle bin:
■ The recycle bin is only available for non-system, locally managed tablespaces. If a
table is in a non-system, locally managed tablespace, but one or more of its
dependent segments (objects) is in a dictionary-managed tablespace, then these
objects are protected by the recycle bin.
■ Tables that have Fine-Grained Auditing (FGA) and Virtual Private Database (VPD)
policies defined over them are not protected by the recycle bin.
■ Partitioned index-organized tables are not protected by the recycle bin.
■ The table must not have been purged, either by a user or by Oracle Database
because of a space reclamation operation.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics