I'm looking for a query listing all the users that have access to a specific database. Hopefully similar to this one but to query Oracle database. SQL Server query to find all permissions/access for all users in a database
2 Answers
A database administrator (DBA) for Oracle can simply execute a query to view the rows in DBA_SYS_PRIVS
, DBA_TAB_PRIVS
, and DBA_ROLE_PRIVS
to retrieve information about user privileges related to the system, tables, and roles, respectively.
For example, a DBA wishing to view all system privileges granted to all users would issue the following query:
SELECT *
FROM DBA_SYS_PRIVS;
To determine which users have direct grant access to a table we’ll use the DBA_TAB_PRIVS
view:
SELECT *
FROM DBA_TAB_PRIVS;
Finally, querying the DBA_ROLE_PRIVS
view has much of the same information but applicable to roles instead, where the GRANTED_ROLE
column specifies the role in question:
SELECT *
FROM DBA_ROLE_PRIVS;
See the entire tutorial here.

- 548
- 5
- 10
-
I'd like to have a single query. – Wendy Oct 02 '18 at 19:41
-
This view lists all grants for a particular user: select * from DBA_TAB_PRIVS where grantee = 'your user'; – Diego Souza Oct 02 '18 at 20:27
To query which user has been granted for a system privilege
such as DEBUG ANY PROCEDURE
, ON COMMIT REFRESH
, INSERT ANY TABLE
, CREATE ANY JOB
, FLASHBACK ANY TABLE
... etc.
select p.* from dba_sys_privs p where p.grantee = upper('<your_user_name>');
To query DML
, EXECUTION
, DEBUG
privileges on an object such as TABLE
, VIEW
, PROCEDURE
, FUNCTION
... etc.
select p.* from dba_tab_privs p where p.grantee = upper('<your_user_name>');
To see which user granted the object privileges
select p.* from dba_tab_privs p where p.owner = upper('<your_user_name>');
may be used.

- 59,113
- 10
- 31
- 55