Oracle恢复被删表的索引/约束
最近逛AskTom,遇到一个不错的提问:
Q:通过Flashback技术如何恢复被删表的索引及约束?
来看看Tom 大神的回答:
A:其实在使用Flashback恢复被删表的同时,其indexes和constraints也被恢复了,只不过名字变为了一BIN$开头的一串随机字符,因为其保留了再recycle bin表中的名字。
我们要做的就是重新命名丢失的索引和约束名。
原文:The indexes and constraints are actually restored by flashback, but you might not have recognized them.
They retain their recycle bin names,so their names start with BIN$ followed by seemingly random characters.
They come back with the table, but their names are lost. All you need to do is rename them.
For example:
alter index "BIN$/y02LoFDTm0bx1GIQtwx0A==$0"
rename to PK_SR_TEST1;
----------------------------------------------------
Let's begin with an example:
1、创建测试表 t:
4、现在授予scott用户闪回查询视图USER_INDEXES和USER_CONSTRAINTS权限并执行闪回查询,找到删除前的索引及约束名:6、修改约束方法一致,此处不再赘述。附上以上操作相关效果图:
-------------------------------------
Present By Dylan.