oracle 我怎样才能给用户,执行其他用户的功​​能?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12403214/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 04:29:08  来源:igfitidea点击:

How can I give to user, execute another users's functions?

oracleprivilegesgrant

提问by Ersin Gülbahar

I want to give privileges to a user to call a function another users function.

我想授予一个用户调用另一个用户函数的权限。

I write this : GRANT EXECUTE ANY FUNCTION TO user;

我这样写: GRANT EXECUTE ANY FUNCTION TO user;

but it doesn't work.

但它不起作用。

user need to call this:

用户需要调用这个:

call XXX.YYY.AlterAllInvalidObjects(NULL,'PACKAGE BODY');

but how can I give grant ?

但我怎么能给予补助呢?

NOTE : I don't want to use : GRANT EXECUTE ON FUNCTION AlterAllInvalidObjects TO user;I need general solution not specific function name.

注意:我不想使用:GRANT EXECUTE ON FUNCTION AlterAllInvalidObjects TO user;我需要通用解决方案而不是特定的函数名称。

回答by Rapha?l Althaus

GRANT EXECUTE ANY PROCEDURE TO user;

http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_9013.htm#i2077938

http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_9013.htm#i2077938

will manage both functions and procedures. You can't grant that way to functions only...

将管理职能和程序。您不能仅将这种方式授予功能...

EDIT

编辑

the other way (but you'll have to run it every time the other user will create a new function to get all the grants):

另一种方式(但每次其他用户创建新函数以获取所有授权时,您都必须运行它):

Run

select 'GRANT EXECUTE ON '||owner||'.'||object_name||' TO user;'
from all_objects
where owner = 'xxx'
and object_type='FUNCTION';

and copy-paste-execute the result...

并复制粘贴执行结果...

or use a SP doing the same thing (cursor on the query and execute immediate in loop)

或使用 SP 做同样的事情(查询上的光标并立即在循环中执行)

回答by Alexander Tokarev

To be honest it looks like you're asking about synonyms, not grants because grants doesn't help you to invoke call AlterAllInvalidObjects without mentioning the schema. Please consider about http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_7001.htm

老实说,您似乎在询问同义词,而不是授权,因为授权并不能帮助您在不提及架构的情况下调用调用 AlterAllInvalidObjects。请考虑一下http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_7001.htm