Search notes:

Oracle: DBA_USERS

DBA_USERS lists all users in a database.
This view comes in three variants: DBA_USERS, ALL_USERS and USER_USERS.

ORACLE_MAINTAINED

By selecting users with where oracle_maintained='Y', it seems possible to find preinstalled user accounts.

Possibly unused objects

More often that I would have imagined, a database system stores abandoned objects with names like 'TMP_IMPORT_2023_04', IMPORT_2023_OLD etc.
The following select statement tries to identify such objects.
select
  *
from
  dba_objects obj
where
(
  obj.owner not in ('SYS', 'PUBLIC') and
  obj.object_type not in ('INDEX')
) and
(
  obj.object_name like 'XX%'     or 
 (obj.object_name like '%TRY'    and obj.object_name not like '%ENTRY') or
  obj.object_name like 'TMP%'    or
  obj.object_name like 'ABC'     or
  obj.object_name like 'TEST%'   or
  obj.object_name like 'DROP%'   or
  obj.object_name like '%OLD'    or
  obj.object_name like '%COPY'   or
  obj.object_name like '%BKP'    or
  regexp_like(obj.object_name, '_$')
)
order by
  obj.created;
Github repository Oracle-Patterns, path: /Installed/data-dictionary/objects/possibly-unused-objects.sql
Use with caution!

Join with V$PWFILE_USERS

select
  usr.username,
  usr.user_id,
  pwf.sysdba,
  pwf.sysoper,
  pwf.sysasm
--pwf.sysbackup,
--pwf.sysdg,
--pwf.syskm
from
  dba_users          usr                                  left join
  v$pwfile_users     pwf on usr.username = pwf.username
;
Github repository Oracle-Patterns, path: /Installed/data-dictionary/users/joins.sql

Column ACCOUNT_STATUS

select
  count(*),
  account_status
from
  dba_users
group by
  account_status
order by
  account_status;
Github repository Oracle-Patterns, path: /Installed/data-dictionary/users/account_status.sql
Users whose account status is LOCKED will get an ORA-28000: The account is locked. error message when trying to log on.
If the status is EXPIRED (GRACE), the user will receive receive an ORA-28002: the password will expire within N days warning when trying to log on.
If the status is EXPIRED, the user will receive an ORA-28001: the password has expired error when trying to connect to the database.
See also the error message ORA-65146: account cannot be unlocked in a PDB while it is locked in the root

Column INHERITED

The value of inherited is YES if the user definition was inherited from another container database and NO otherwise.

See also

data dictionary
Joining dba_users with v$sqlarea.
proxy_users
dba_profiles
dba_users_with_defpwd
As far as I can tell, there is no dba_hist_* view for dropped users.

Index