Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 675
Chris Farmer Avatar asked Mar 10 '10 16:03

Chris Farmer


2 Answers

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

SELECT * FROM ROLE_TAB_PRIVS WHERE ROLE = 'MyRole';

like image 126
Shyamkkhadka Avatar answered Nov 23 '22 05:11

Shyamkkhadka


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
like image 32
Theodore.C Avatar answered Nov 23 '22 07:11

Theodore.C