dept表中的 deptno 是pk 所在列, 同时在emp表上的deptno列,有外键,并且和dept 的deptno 存在关联关系,
而在emp 的empno上边,存在emp表自己的主键,现在 DROP TABLE emp;
FLASHBACK TABLE emp TO BEFORE DROP; 到底 emp 的pk 和fk 哪一个约束依旧有效?INSERT INTO emp VALUES (2,COTT 10);
INSERT INTO emp VALUES (3,ING 55);
这是 047中间的一个考题
In the DEPT table, DEPTNO is the PRIMARY KEY.
In the EMP table, EMPNO is the PRIMARY KEY and DEPTNO is the FOREIGN KEY
referencing the DEPTNO column in the DEPT table.
What would be the outcome of the following statements executed in the given
sequence?
DROP TABLE emp;
FLASHBACK TABLE emp TO BEFORE DROP;
INSERT INTO emp VALUES (2,COTT 10);
INSERT INTO emp VALUES (3,ING 55);dept表的数据
deptno
10
20emp 表的数据
empno     ename    deptno
1        king       10
2         hari      20
D. Only the second INSERT statement would succeed because all the constraints
except referential integrity constraints that reference other tables are
retrieved automatically after the table is flashed back.
Answer: D有些不解
 

解决方案 »

  1.   

    之前注意过,但是记不太清楚了,重新查了下官方文档的说明如下:
    http://docs.oracle.com/cd/B19306_01/backup.102/b14192/flashptr004.htm
    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.INSERT INTO emp VALUES (2,COTT 10);
    INSERT INTO emp VALUES (3,ING 55);
    再次执行是执行不了的,报错
      

  2.   

    最主要的
    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.会重新建立外键