Thursday, January 27, 2011

Oracle : report roles assigned to users (SQL)

select
  username,
  default_tablespace    dts,
  temporary_tablespace  tts,
  profile prof,
  granted_role || ' ' ||
  decode(admin_option,'YES','- A',' ') ||
  decode(granted_role,'YES','- G',' ') role
from
  dba_users,
  dba_role_privs
where
  dba_users.username = dba_role_privs.grantee and
  username not in ('PUBLIC')
order by
  1,2,3,4;