How to find the privileges and roles granted to a user in Oracle? [duplicate] How to find the privileges and roles granted to a user in Oracle? [duplicate] oracle oracle

How to find the privileges and roles granted to a user in Oracle? [duplicate]


In addition to VAV's answer, The first one was most useful in my environment

select * from USER_ROLE_PRIVS where USERNAME='SAMPLE';select * from USER_TAB_PRIVS where Grantee = 'SAMPLE';select * from USER_SYS_PRIVS where USERNAME = 'SAMPLE';


Look at http://docs.oracle.com/cd/B10501_01/server.920/a96521/privs.htm#15665

Check USER_SYS_PRIVS, USER_TAB_PRIVS, USER_ROLE_PRIVS tables with these select statements

SELECT * FROM USER_SYS_PRIVS; SELECT * FROM USER_TAB_PRIVS; SELECT * FROM USER_ROLE_PRIVS;


None of the other answers worked for me so I wrote my own solution:

As of Oracle 11g.

Replace USER with the desired username

Granted Roles:

SELECT *   FROM DBA_ROLE_PRIVS  WHERE GRANTEE = 'USER';

Privileges Granted Directly To User:

SELECT *   FROM DBA_TAB_PRIVS  WHERE GRANTEE = 'USER';

Privileges Granted to Role Granted to User:

SELECT *   FROM DBA_TAB_PRIVS   WHERE GRANTEE IN (SELECT granted_role                      FROM DBA_ROLE_PRIVS                     WHERE GRANTEE = 'USER');

Granted System Privileges:

SELECT *   FROM DBA_SYS_PRIVS  WHERE GRANTEE = 'USER';

If you want to lookup for the user you are currently connected as, you can replace DBA in the table name with USER and remove the WHERE clause.