← Users & Privileges
Oracle · Users & Privileges

How to find who has the DBA role in Oracle

Find who holds the DBA role and other powerful system privileges in an Oracle database, for a security review.

Tested on11g12c19c21c23ai26ai

A security check: who holds the DBA role, directly or with admin option, plus accounts carrying powerful system privileges like SELECT ANY TABLE and GRANT ANY PRIVILEGE.

-- Who holds the DBA role
SELECT grantee, admin_option
FROM   dba_role_privs
WHERE  granted_role = 'DBA'
ORDER  BY grantee;

-- Accounts and roles with powerful system privileges
SELECT grantee, privilege
FROM   dba_sys_privs
WHERE  privilege IN ('SELECT ANY TABLE','ALTER ANY TABLE','DROP ANY TABLE',
                     'GRANT ANY PRIVILEGE','GRANT ANY ROLE','ALTER SYSTEM',
                     'CREATE ANY PROCEDURE','EXECUTE ANY PROCEDURE','BECOME USER')
ORDER  BY privilege, grantee;
securitydba-roleprivilegesaudit