如何枚举授予Oracle角色的权限列表?

时间:2010-03-10 16:21:21

标签: oracle plsql roles

我有一个很久以前创建的本土Oracle角色:

create role MyRole;

它已被授予从某些表和视图中选择,插入,更新和删除的功能。

grant select on sometable to MyRole;
grant insert on sometable to MyRole;
grant select on someothertable to MyRole;
-- etc.

我现在如何枚举授予该角色的特定权限列表?我有兴趣发现特定的表格以及这个角色对每个表格的权利。我该如何恢复这些信息?

2 个答案:

答案 0 :(得分:12)

您只需从数据字典ROLE_TAB_PRIVS进行搜索即可。并且这样做

  

SELECT * FROM ROLE_TAB_PRIVS WHERE ROLE ='MyRole';

答案 1 :(得分:5)

这很有效:

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