创建oracle dblink权限不足,Oracle-存储过程-创建sequence的时候报权限不足

引用自:http://www.cnblogs.com/yhoralce/p/6817010.html

在包体里写了一个过程,test执行时报错,但是如果把该过程单独拿出来创建一个,就能顺利执行。

在没加上调用者权  authid current_user之前,报错如下

ORA-01031: insufficient privileges。ORA-06512: at "RT_ANN_ODS.ODS_EI_WDNEW", line 1720

查了01031,发现是缺少权限,那么问题就来了,缺少什么权限?

过程能编译完成,只是测试时候报错,那么就是缺少调用者权限了。

锁定了这个问题,就输入调用者权限即可。

在单一的过程中,调用者权限是这样用的:

827c781ff9f48fa7fd7b20f4c3ff36fe.gif

create or replace procedure p_test

2 Authid Current_User ----写在过程名称之后,is之前

3 is

4 begin

5 execute immediate 'create sequence SEQ_TBS minvalue 10001 maxvalue 99999 start with 10001 increment by 1cache 10';6 end;

c2a0b671b80ce52281f1cb6bef3fec0b.gif

于是在包体里的过程名称后边加上Authid Current_User,编译,报错如下:

PLS-00157:   AUTHID only allowed on schema-level programs

这句话的意思是说,AUTHID只能用字啊顶级的项目,也就是在包里使用才能生效。

查了下错误原因 An AUTHID clause was specified for a subprogram inside a package or type. These clauses are only supported for top-level stored procedures, packages, and types.

大致意思就是authid只能用在顶级的存储过程、包、类型上,不能用在包或类型的子程序上。

在包上加入authid,执行正常了。

create or replace package p_test

authid current_user

is

……

到此,问题解决。