我们知道 Flashback Table可以把drop掉的表从回收站里恢复回来,但是并不是关于该表的所有东西都能被Flashback回来,比如外键约束。

duzz$scott@orcl>create table d(deptno number primary key, deptname varchar2(20)); Table created. Elapsed: 00:00:00.28 duzz$scott@orcl>create table e(empno number primary key, ename varchar2(20), deptno number, constraint fk_dept foreign key (deptno) references d(deptno)); Table created. Elapsed: 00:00:00.39 duzz$scott@orcl>select * from d; DEPTNO DEPTNAME ---------- ----------- 10 IT 20 HR Elapsed: 00:00:00.03 duzz$scott@orcl>select * from e; EMPNO ENAME DEPTNO ---------- ------------- ---------- 1 KING 10 2 HARI 20 Elapsed: 00:00:00.00 duzz$scott@orcl>select constraint_name,constraint_type,table_name from user_constraints where table_name in ('D','E'); CONSTRAINT_NAME CON TABLE_NAME -------------------- --- ------------- SYS_C005553 P D SYS_C005554 P E FK_DEPT R E Elapsed: 00:00:00.00 duzz$scott@orcl>insert into e values(2,'COTT',10); insert into e values(2,'COTT',10) * ERROR at line 1: ORA-00001: unique constraint (SCOTT.SYS_C005554) violated Elapsed: 00:00:00.01 duzz$scott@orcl>insert into e values(3,'ING',55); insert into e values(3,'ING',55) * ERROR at line 1: ORA-02291: integrity constraint (SCOTT.FK_DEPT) violated - parent key not found Elapsed: 00:00:00.01 duzz$scott@orcl>drop table e; Table dropped. Elapsed: 00:00:00.09 duzz$scott@orcl>flashback table e to before drop; Flashback complete. Elapsed: 00:00:00.10 duzz$scott@orcl>select constraint_name,constraint_type,table_name from user_constraints where table_name in ('D','E'); CONSTRAINT_NAME CON TABLE_NAME -------------------- --- --------------- SYS_C005553 P D BIN$MzYoteesSWeEWRlJ P E Afkfcg==$0 Elapsed: 00:00:00.00 duzz$scott@orcl>insert into e values(2,'COTT',10); insert into e values(2,'COTT',10) * ERROR at line 1: ORA-00001: unique constraint (SCOTT.BIN$MzYoteesSWeEWRlJAfkfcg==$0) violated Elapsed: 00:00:00.01 duzz$scott@orcl>insert into e values(3,'ING',55); 1 row created. Elapsed: 00:00:00.00 duzz$scott@orcl>

除此之外,带有细粒度审计(Fine-Grained Auditing )和虚拟专用数据库策略(Virtual Private Database policies)的表也不可恢复的哦,请看Oracle官方的Flashback说明:

A table and all of its dependent objects (indexes, LOB segments, nested tables, triggers, constraints and so on) go into the recycle bin together, when you drop the table. Likewise, when you perform Flashback Drop, the objects are generally all retrieved together.

It is possible, however, that some dependent objects such as indexes may have been reclaimed due to space pressure. In such cases, the reclaimed dependent objects are not retrieved from the recycle bin.

Due to security concerns, tables which 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 recycle bin does not preserve referential constraints on a table (though other constraints will be preserved if possible). If a table had referential constraints before it was dropped (that is, placed in the recycle bin), then re-create any referential constraints after you retrieve the table from the recycle bin with Flashback Drop.

REF:

http://download.oracle.com/docs/cd/B19306_01/backup.102/b14192/flashptr004.htm

转载于:https://www.cnblogs.com/zlja/archive/2011/08/25/2449075.html

Oracle PL/SQL之Flashback Table与外键约束相关推荐

  1. 五、SQL–索引/约束⑥(外键约束)

    引出: 当一些信息在表中重复出现时,就要考虑要将它们提取到新的表中,并在源表中引用新创建的中的数据. 如:很多作者都著有不止一本著作,所以在保存书籍信息的时候,应该把作者信息放到单独的表中,创建表的S ...

  2. oracle 所有外键约束,如何在oracle中找到所有外键约束?

    在StackOverflow中,我可以找到有关如何在SQL Server中查找所有外键约束的文章. 我只能在Oralce中找到有关如何查找表的所有外键约束的文章(外键列表和它们引用的表). 我的问题是 ...

  3. oracle唯一约束null,Oracle外键约束中NULL的处理

    Oracle的NULL一直是一个有趣的话题,只要存在NULL,就可能会出现意想不到的结果.Oracle在外键中处理NULL约束,采用的方法就和处理唯一约束中明显不同. 前面写过一篇文章,介绍过唯一约束 ...

  4. oracle去除检查非空,oracle 主键,非空,检查,唯一,默认,外键约束

    --首先添加主键约束 alter table student add constraint PK_student_sno primary key(sno) --删除约束 alter table stu ...

  5. [顶]ORACLE PL/SQL编程详解之二:PL/SQL块结构和组成元素(为山九仞,岂一日之功)...

    [顶]ORACLE PL/SQL编程详解之二:PL/SQL块结构和组成元素(为山九仞,岂一日之功) 原文:[顶]ORACLE PL/SQL编程详解之二:PL/SQL块结构和组成元素(为山九仞,岂一日之 ...

  6. ORACLE PL/SQL编程之八:把触发器说透

    ORACLE PL/SQL编程之八:把触发器说透 ORACLE PL/SQL编程之八: 把触发器说透 大家一定要评论呀,感谢!光发表就花了我将近一个下午. 本篇主要内容如下: 8.1 触发器类型 8. ...

  7. [强烈推荐]ORACLE PL/SQL编程详解之七:程序包的创建与应用(聪明在于学习,天才在于积累!)...

    [强烈推荐]ORACLE PL/SQL编程详解之七: 程序包的创建与应用(聪明在于学习,天才在于积累!) --通过知识共享树立个人品牌.   继上七篇:            [推荐]ORACLE P ...

  8. Oracle PL/SQL语言初级教程(自学)

    Oracle PL/SQL语言初级教程 PL/SQL 语言基础 PL/SQL 是一种高性能的基于事务处理的语言,能运行在任何 ORACLE 环境中,支持所有数据处理命令. 通过使用 PL/SQL 程序 ...

  9. Oracle PL/SQL编程详解

    Oracle PL/SQL编程详解 - 古立 - 博客园 <我的网络摘抄本> 网摘/转载/备忘/随记 博客园 首页 新随笔 联系 管理 订阅 随笔- 84  文章- 0  评论- 0  & ...

最新文章

  1. 利用 Linux 查找重复文件
  2. Python 第2周 - Python基础-模块\数据运算
  3. 分布式事务解决方案之 Alibaba Seata1.3.0 seata-server 1.3.0
  4. 开学一月,可以自己玩自己做的游戏了!!!
  5. perl 远程 mysql_写的一个perl脚本,用于发送远程MySQL命令 -电脑资料
  6. JS小技巧 ----- 在onmousedown事件下避免文本选取
  7. 三菱M80操作介绍_共享屋:三菱M70 PLC 转M80操作步骤
  8. html5自定义组件样式,Taro 自定义组件样式不生效及解决方案
  9. mysql long类型格式_MySQL 数据类型
  10. day4-数字类型和列表基础
  11. Struts-2.3.24.1官方例子-struts2-blank
  12. emlog mysql 设置_EMLOG模板自定义首页
  13. 微信点餐html5模板,【瑞蚁原创分享】12:springboot微信点餐之微信模板
  14. 印象笔记,石墨笔记和Effie哪个更适合学生?
  15. 批量制作带LOGO的网址二维码
  16. 楼宇内的一个计算机网络属于,网络技术期末考试题及答案
  17. AD使用笔记1 原理图与PCB布局同步实现
  18. 微信小程序设置tabBar选中颜色和图标
  19. 1088: 手机短号 (多实例)____酸菜鱼(h404j)的博客
  20. 寻仙手游服务器维修,寻仙手游11月30日部分服务器数据互通公告

热门文章

  1. Error: bin/bash^M: bad interpreter: no such file o
  2. 动态生成一个继承接口的类
  3. 浅谈分布式CAP定理
  4. 驳斥苹果“诊断后门论”,声援扎德尔斯基
  5. 【转】使用Core Graphics绘画一个山寨微信icon
  6. Java与邮件系统交互之使用Socket验证邮箱是否存在
  7. the 12th UESTC Programming Contest Final Justice is Given by Light (几何+ 二分)
  8. 发布Apworks应用开发框架(Alpha版本)
  9. Python入门习题9.数码管时间
  10. HTTP 错误 404.15 - Not Found请求筛选模块被配置为拒绝包含的查询字符串过长的请求...