Oracle SELECT 已授予但仍无法跨用户访问表

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19703865/
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-19 02:03:35  来源:igfitidea点击:

Oracle SELECT granted but still can't access table across users

oraclepermissionsrolesgrant

提问by Xophmeister

Can any one see what's wrong with this:

任何人都可以看到这有什么问题:

User ABC:

用户ABC:

create table def.something (
  id number,
  ref number references def.anotherTable(id)
);

create role ROUser;

grant select on def.something to ROUser;

grant ROUser to ghi;

User DEF:

用户 DEF:

select * from something;
...
X rows returned

User GHI:

用户 GHI:

select * from def.something;
ORA-00942: table or view does not exist

Is the fact that there's a foreign key, that GHI doesn't have access to, on def.somethingthe problem?

是否存在 GHI 无法访问的外键def.something



EDITI've just tried this again on another server and it works fine (i.e., as expected). Not entirely sure what's going on here, but I think it may have something to do with some error on my part... As such, I'm voting to close the question.

编辑我刚刚在另一台服务器上再次尝试了这个,它工作正常(即,正如预期的那样)。不完全确定这里发生了什么,但我认为这可能与我的一些错误有关......因此,我投票结束这个问题。

回答by Przemyslaw Kruglej

You are most probably running that SELECTstatement in PL/SQL block? In PL/SQL, priviliges granted through roles are not recognized. Try adding direct SELECTprivilege on that table and see if it works.

您很可能SELECT在 PL/SQL 块中运行该语句?在 PL/SQL 中,无法识别通过角色授予的特权。尝试SELECT在该表上添加直接权限,看看它是否有效。