我有一个很久以前创建的本土Oracle角色:
create role MyRole;
它已被授予从某些表和视图中选择,插入,更新和删除的功能。
grant select on sometable to MyRole;
grant insert on sometable to MyRole;
grant select on someothertable to MyRole;
-- etc.
我现在如何枚举授予该角色的特定权限列表?我有兴趣发现特定的表格以及这个角色对每个表格的权利。我该如何恢复这些信息?
答案 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