ORACLE DB user_constraints没有表

时间:2012-11-27 15:58:35

标签: oracle

我有一个没有表的Oracle模式(我放弃了它们)。当我查看user_constraints表时,无论如何

    SELECT * FROM user_constraints;

我看到了很多行。如何删除这些约束?

    DELETE FROM user_constraints WHERE owner='owner';

没有用,它给了我一个“权限不足”的错误。

    SELECT owner, constraint_name, constraint_type, table_name, r_owner, r_constraint_name  FROM user_constraints;

    OWNER                          CONSTRAINT_NAME                CONSTRAINT_TYPE TABLE_NAME                     R_OWNER                        R_CONSTRAINT_NAME            
    ORA_AI_1_9                     BIN$z2XwnFUHEHrgQ4sGOR4Qeg==$0 P               BIN$z2XwnFUJEHrgQ4sGOR4Qeg==$0                                                               

    ORA_AI_1_9                     BIN$z1NhC6g4oErgQ4sGOR6gSg==$0 P               BIN$z1NhC6g6oErgQ4sGOR6gSg==$0                                                               

    ORA_AI_1_9                     BIN$z1anK5OEEHrgQ4sGOR4Qeg==$0 P               BIN$z1anK5OGEHrgQ4sGOR4Qeg==$0                                                               

    ORA_AI_1_9                     BIN$z1NhC6hhoErgQ4sGOR6gSg==$0 P               BIN$z1NhC6hjoErgQ4sGOR6gSg==$0            

3 个答案:

答案 0 :(得分:3)

你也是10 / 11g,也许有recylebin?

SQL> select count(*) from user_tables;

  COUNT(*)
----------
         0

SQL> select count(*) from user_constraints;

  COUNT(*)
----------
         0

SQL> create table foo(id number primary key);

Table created.

SQL> ALTER SESSION SET recyclebin = ON;

Session altered.

SQL> select count(*) from user_tables;

  COUNT(*)
----------
         1

SQL> select count(*) from user_constraints;

  COUNT(*)
----------
         1

SQL> drop table foo;

Table dropped.

SQL> select count(*) from user_constraints;

  COUNT(*)
----------
         1

SQL> select count(*) from user_tables;

  COUNT(*)
----------
         0

SQL>

你可以清除重新定位以解决这个问题。

SQL> purge recyclebin;

Recyclebin purged.

SQL> select count(*) from user_constraints;

  COUNT(*)
----------
         0

答案 1 :(得分:1)

你可以发表DROP TABLE [schema.]table_name [CASCADE CONSTRAINTS]

之类的陈述

答案 2 :(得分:0)

首先,您不应该直接针对像user_constraints这样的数据字典表执行DML。

其次,您是否拥有在其他用户拥有的表上创建的约束?什么

SELECT owner, constraint_name, constraint_type, table_name, r_owner, r_constraint_name
  FROM user_constraints

返回?