开发者

How can I enumerate the list of privileges granted to an Oracle role?

开发者 https://www.devze.com 2022-12-22 07:37 出处:网络
I have a homegrown Oracle role that was created long ago: create role MyRole; It\'s been granted the ability to select, insert, update, and delete from some tables and views.

I have a homegrown Oracle role that was created long ago:

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?


You can simply search from data dictionary ROLE_TAB_PRIVS. And do like this

SELECT * FROM ROLE_TAB_PRIVS WHERE ROLE = 'MyRole';


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
0

精彩评论

暂无评论...
验证码 换一张
取 消