DBMS_REDEFINITION.start_redef_table没有足够的权限错误

时间:2014-05-22 11:27:28

标签: oracle plsql oracle10g dbms-redefinition

我正在尝试对现有表进行分区而不删除并使用Oracle重新创建它。

我的Oracle 10g支持应用程序中的DBMS_REDEFINITION包

我已经按照oracle文档中提到的那样向用户提供了所有必要的权限。

grant CREATE ANY TABLE to DDUSER;
grant ALTER ANY TABLE to DDUSER;
grant DROP ANY TABLE to DDUSER;
grant LOCK ANY TABLE to DDUSER;
grant SELECT ANY TABLE to DDUSER;
grant execute on dbms_redefinition to DDUSER;

我可以执行以下程序

begin
Dbms_Redefinition.Can_Redef_Table('DDUSER', 'TABLE');
end;
This throws no error neither any result (Assuming this is as expected)

但是当我试图运行时

BEGIN
  DBMS_REDEFINITION.start_redef_table(
    uname      => 'DDUSER',        
    orig_table => 'TABLE',
    int_table  => 'TABLE_1');
END;

我收到以下错误:

  

错误报告:
  ORA-01031:特权不足
  ORA-06512:在“SYS.DBMS_REDEFINITION”,第50行   ORA-06512:在“SYS.DBMS_REDEFINITION”,第1343行   ORA-06512:第2行   01031. 00000 - “权限不足”

你能帮助我吗,我在这里失去了什么特权? 或者如果知道在DBMS_REDEFINITION包中第50行执行了哪些操作?

4 个答案:

答案 0 :(得分:3)

试试这个:

grant DROP ANY INDEX to DDUSER;
grant CREATE ANY INDEX to DDUSER;

如果tabls包含索引(很可能是这种情况),则必须创建新索引。

答案 1 :(得分:1)

在Oracle 12c上还有额外的系统权限'REDEFINE ANY TABLE'。

这适合我。

grant REDEFINE ANY TABLE  to myUser;
grant ADMINISTER DATABASE TRIGGER to myUser;
grant ALTER ANY INDEX to myUser; 
grant ALTER ANY MATERIALIZED VIEW to myUser;
grant ALTER ANY SEQUENCE to myUser;
grant ALTER ANY TRIGGER to myUser;
grant CREATE ANY INDEX to myUser;
grant CREATE ANY MATERIALIZED VIEW to myUser;
grant CREATE ANY SEQUENCE to myUser;
grant CREATE ANY TABLE to myUser;
grant CREATE ANY TRIGGER to myUser;
grant CREATE ANY VIEW to myUser;
grant CREATE MATERIALIZED VIEW to myUser;
grant CREATE SESSION to myUser;
grant CREATE VIEW to myUser;
grant DROP ANY INDEX to myUser;
grant DROP ANY MATERIALIZED VIEW to myUser;
grant DROP ANY SEQUENCE to myUser;
grant DROP ANY TRIGGER to myUser;
grant DROP ANY VIEW to myUser;
grant EXECUTE ANY PROCEDURE to myUser;
grant INSERT ANY TABLE to myUser;
grant MERGE ANY VIEW to myUser;
grant SELECT ANY DICTIONARY to myUser;
grant SELECT ANY TABLE to myUser;
grant UNDER ANY VIEW to myUser;
grant UPDATE ANY TABLE to myUser;
祝你好运

答案 2 :(得分:1)

我刚刚遇到了这个问题。而且我在start_redef_table上遇到了完全相同的错误。

因此,在进行了大量搜索之后,我向用户授予了以下特权,并且该特权有效。

grant execute on dbms_redefinition package to myuser(您已经拥有)

然后

grant CREATE ANY TABLE to myuser;

grant  ALTER ANY TABLE to myuser;

grant  DROP ANY TABLE to myuser;

grant LOCK ANY TABLE to myuser;

grant SELECT ANY TABLE to myuser;

赋予这些特权后,start_redef_table可以正常工作。

答案 3 :(得分:0)

您缺少CREATE物化视图 添加此内容后,我已成功重新定义为普通用户

对于Oracle 12.1指令说 https://docs.oracle.com/database/121/ARPLS/d_redefi.htm#ARPLS67511

我认为在其他版本中可能是相同的

grant CREATE MATERIALIZED VIEW 
grant CREATE TABLE 
grant EXECUTE on dbms_redefinition