0
点赞
收藏
分享

微信扫一扫

Oracle 授权编译指定包、函数、存储过程


Oracle中编译包、函数、存储过程需要有 ALTER ANY PROCEDURE 权限,如果是通过CREATE OR REPLACE PACKAGE 方式编译,则需要添加create ANY PROCEDURE 权限,开发一般还会需要debug权限。

--编译
grant create ANY PROCEDURE,ALTER ANY PROCEDURE to test;
--debug
grant debug connect session to test;
--执行
grant execute on apps.testpkg to test;

当然这个权限很大,要限制仅编译某个包,还可以通过以下方式赋权

create or replace procedure p1 is
begin
   execute immediate 'alter package pkg1 compile';
end;
/

grant execute on p1 to u1;

测试编译

SQL> connect u1/u1
Connected.
SQL> alter package scott.pkg1 compile;
alter package scott.pkg1 compile
*
ERROR at line 1:
ORA-01031: insufficient privileges

SQL> exec scott.p1;

举报

相关推荐

0 条评论