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_roles
view:
select * from dba_views where view_name = 'DBA_ROLES';
Here's the code on my system:
select name, decode(password, null, 'NO',
'EXTERNAL', 'EXTERNAL',
'GLOBAL', 'GLOBAL',
'YES'),
decode(password, null, 'NONE',
'EXTERNAL', 'EXTERNAL',
'GLOBAL', 'GLOBAL',
'APPLICATION', 'APPLICATION',
'PASSWORD')
from user$
where type# = 0 and name not in ('PUBLIC', '_NEXT_USER');
When I run select * from sys.user$ where type# = 0 order by ctime;
I see a lot of views with a ctime
at 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 ctime
might 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
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.