1

In Oracle 19c database, how can I find out tablespace, schema, tables allowed to access, privileges assigned to a user grouping by that username ?

zafar
  • 44
  • 4

1 Answers1

1

Are you looking for something like this?

Replace USER with the desired username


Granted Roles:

SELECT * 
  FROM DBA_ROLE_PRIVS 
 WHERE GRANTEE = 'USER';

Privileges Granted Directly To User:

SELECT * 
  FROM DBA_TAB_PRIVS 
 WHERE GRANTEE = 'USER';
Privileges Granted to Role Granted to User:

SELECT * 
  FROM DBA_TAB_PRIVS  
 WHERE GRANTEE IN (SELECT granted_role 
                     FROM DBA_ROLE_PRIVS 
                    WHERE GRANTEE = 'USER');
Granted System Privileges:

SELECT * 
  FROM DBA_SYS_PRIVS 
 WHERE GRANTEE = 'USER';

If you want to lookup for the user you are currently connected as, you can replace DBA in the table name with USER and remove the WHERE clause.

Beefstu
  • 804
  • 6
  • 11
  • Hi Beeftsu, Thanks for your prompt reply. Let me give you the whole scenario: Like 'beefstu' is a user, so the generated schema "beefstu" & this schema is contained by a tablespace1. There are another user named "beefstu11"; so the cronology continues for "beefstu11" schema and contained by "tablespace2". "beefstu" has access to some tables of schema "befstu11" , vice versa "beefstu11" has also access to some table of "beefstu" schema. Now in query it needs be shown by username (where user = beefstu), corressponding tablespace name, schema names, table names, privileges given. – zafar Aug 13 '22 at 18:43
  • I'm not sure how to provide the results you want. You may want to consider posting your question at asktom.com they work at oracle and may provide insight. It's a free service where Oracle Ace answers questions – Beefstu Aug 13 '22 at 21:54
  • Thank. Will post tin Beefstu. – zafar Aug 14 '22 at 03:59