After searching online and reading the Oracle documentation for this, I need some help in getting all of the custom roles found in an Oracle database. Since I can’t find a good resource that gives me the logical model of the system tables or data dictionaries (so I could see where the dba_role is mapped to), the best I could come up with was:
select role from dba_roles
and then from there filter out any sys or sysdba role that I know — which I know might not be correct.
Any helpful pointers for which table to use would be appreciated.
You can find the SQL behind the
dba_rolesview:Here’s the code on my system:
When I run
select * from sys.user$ where type# = 0 order by ctime;I see a lot of views with actimeat about the same time, several years ago. (The time is even before my database was created.) It’s probably safe to assume that the old roles are system generated.But that does not necessarily mean that the newest roles are all custom roles. The
ctimemight change after an upgrade or re-compile, or if you install new options.It may be helpful to install a new instance and subtract whatever you see in that
dba_roles.