如何枚举授予 Oracle 角色的权限列表?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2418541/
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
How can I enumerate the list of privileges granted to an Oracle role?
提问by Chris Farmer
I have a homegrown Oracle role that was created long ago:
我有一个很久以前创建的本土 Oracle 角色:
create role MyRole;
It's been granted the ability to select, insert, update, and delete from some tables and views.
它被授予从某些表和视图中选择、插入、更新和删除的能力。
grant select on sometable to MyRole;
grant insert on sometable to MyRole;
grant select on someothertable to MyRole;
-- etc.
How can I now enumerate the specific list of privileges that were granted to the role? I am interested in discovering the specific tables and the rights this role has with respect to each table. How can I recover this information?
我现在如何枚举授予角色的特定权限列表?我有兴趣发现特定的表以及此角色对每个表的权限。我怎样才能恢复这些信息?
回答by Shyamkkhadka
You can simply search from data dictionary ROLE_TAB_PRIVS
. And do like this
您可以简单地从数据字典中搜索ROLE_TAB_PRIVS
。这样做
SELECT * FROM ROLE_TAB_PRIVS WHERE ROLE = 'MyRole';
SELECT * FROM ROLE_TAB_PRIVS WHERE ROLE = 'MyRole';
回答by Theodore.C
this works well:
这很好用:
SELECT DBA_TAB_PRIVS.GRANTEE, TABLE_NAME, PRIVILEGE,DBA_ROLE_PRIVS.GRANTEE
FROM DBA_TAB_PRIVS, DBA_ROLE_PRIVS
WHERE DBA_TAB_PRIVS.GRANTEE = DBA_ROLE_PRIVS.GRANTED_ROLE
AND DBA_TAB_PRIVS.GRANTEE='<ENTER GROUP ROLE HERE>'
AND DBA_ROLE_PRIVS.GRANTEE = '<ENTER ROLE HERE>'
ORDER BY DBA_ROLE_PRIVS.GRANTEE