SELECT username FROM dba_users;
SELECT username
FROM dba_users u
WHERE EXISTS (
SELECT 1
FROM dba_objects o
WHERE o.owner = u.username );
SELECT username
FROM dba_users
WHERE default_tablespace not in ('SYSTEM','SYSAUX');
-- Excluindo da consulta os usuários nativos do SGBD Oracle --
SELECT username
FROM dba_users
WHERE username NOT IN('QS_CB','PERFSTAT','QS_ADM','PM','SH','HR','OE','ODM_MTR','WKPROXY','ANONYMOUS','OWNER',
'SYS','SYSTEM','SCOTT','SYSMAN','XDB','DBSNMP','EXFSYS','OLAPSYS','MDSYS','WMSYS','WKSYS','DMSYS','ODM','EXFSYS',
'CTXSYS','LBACSYS','ORDPLUGINS','SQLTXPLAIN','OUTLN','TSMSYS','XS$NULL','TOAD','STREAM','SPATIAL_CSW_ADMIN',
'SPATIAL_WFS_ADMIN','SI_INFORMTN_SCHEMA','QS','QS_CBADM','QS_CS','QS_ES','QS_OS','QS_WS','PA_AWR_USER',
'OWBSYS_AUDIT','OWBSYS','ORDSYS','ORDDATA','ORACLE_OCM','MGMT_VIEW','MDDATA','FLOWS_FILES','FLASHBACK',
'AWRUSER','APPQOSSYS','APEX_PUBLIC_USER','APEX_030200','FLOWS_020100');
SELECT username
FROM dba_users u
WHERE EXISTS (
SELECT 1
FROM dba_objects o
WHERE o.owner = u.username )
AND default_tablespace not in ('SYSTEM','SYSAUX');
SELECT distinct owner
FROM dba_segments
WHERE owner in (SELECT username FROM dba_users WHERE default_tablespace not in ('SYSTEM','SYSAUX'));