Oracle User Privileges Scan
Christian Screen | | April 26, 2010

I had been looking for a really quick way to diagnose the roles and privileges of users that I created in a test database.
I snagged this code snippet from the web some time ago (Sorry, I no longer have the reference if any credit is due at all). I am posting it here mainly for my reference but perhaps it will help someone else as well.
select
lpad(' ', 2*level) || granted_role "User, his roles and privileges"
from
(
/* THE USERS */
select
null grantee,
username granted_role
from
dba_users
where
username like upper('%&enter_username%')
/* THE ROLES TO ROLES RELATIONS */
union
select
grantee,
granted_role
from
dba_role_privs
/* THE ROLES TO PRIVILEGE RELATIONS */
union
select
grantee,
privilege
from
dba_sys_privs
)
start with grantee is null
connect by grantee = prior granted_role;
Subscribe to Our Blog
Never miss a post! Stay up to date with the latest database, application and analytics tips and news. Delivered in a handy bi-weekly update straight to your inbox. You can unsubscribe at any time.
Popular Posts
Art of BI: BI Publisher (BIP) Quick Guide and Tips
Read our blog post on how to take over production support of BI Publisher reports.
How to Index a Fact Table – A Best Practice
At the base of any good BI project is a solid data warehouse or data mart.
Art of BI: How to Add Comments in Oracle BI (OBIEE)
Ultimately the goal of commentary in OBIEE is to have a system for persisting feedback, creating a call to action, and recognizing the prolific users.