ITPub博客

首页 > 数据库 > Oracle > ORA-02449: unique/primary keys in table referenced by foreign keys

ORA-02449: unique/primary keys in table referenced by foreign keys

Oracle 作者:urgel_babay 时间:2016-02-29 17:29:45 0 删除 编辑
2014.9.24 16:00
刚刚在删除一个表空间的时候报错:
SQL> drop tablespace K9EDM_DATA INCLUDING CONTENTS and datafiles;
drop tablespace K9EDM_DATA INCLUDING CONTENTS and datafiles
*
ERROR at line 1:
ORA-02449: unique/primary keys in table referenced by foreign keys

查看官方文档:
ORA-02449: unique/primary keys in table referenced by foreign keys
Cause: An attempt was made to drop a table with unique or primary keys referenced by foreign keys in another table.
Action: Before performing the above operations the table, drop the foreign key constraints in other tables. You can see what constraints are referencing a table by issuing the following command: SELECT * FROM USER_CONSTRAINTS WHERE TABLE_NAME = "tabnam";

看这个错误应该多发生在删除表的时候。
先来看怎么解决吧:

ORA-02449错误提示,提示很清晰的描述了因存在子表引用了这个表空间中的表导致无法删除。。
如果使用“CASCADE CONSTRAINTS”选项,表空间便可以删除成功。
SQL> drop tablespace K9EDM_DATA INCLUDING CONTENTS and datafiles CASCADE CONSTRAINTS;

Tablespace dropped.


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30936525/viewspace-2016715/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2016-02-29

  • 博文量
    203
  • 访问量
    339131