Sunday, April 3, 2016

Oracle – Find Users With DBA Privilege

Oracle – Find Users With DBA Privilege

If you wish to know which users have been granted the dba role then you need to query the dba_role_privs in the SYS schema.

This role tells you the grantee, granted_role, whether they have admin option granted, and whether the role is their default role:

SQL> desc dba_role_privs
Name         Null?    Type
------------ -------- -----------------------------
GRANTEE               VARCHAR2(30)
GRANTED_ROLE NOT NULL VARCHAR2(30)
ADMIN_OPTION          VARCHAR2(3)
DEFAULT_ROLE          VARCHAR2(3)

To find a list of all users with DBA privilege execute the following code:

SQL> select * from dba_role_privs where granted_role='DBA';

GRANTEE   GRANTED_ROLE ADM DEF
--------- ------------ --- ----------------------------
SYS                 DBA             YES YES
SYSTEM         DBA             YES YES

No comments:

Post a Comment