Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can I list privileges that were granted DIRECTLY to a user in Oracle?

Seems like simple selects from session_privs and user_sys_privs give all current privileges, but I cannot differentiate which of them are inherited from a role and which were granted directly.

Is there a way of listing ONLY directly granted privileges?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

If you query dictionary, here’s some interesting result:

SQL> select * from dictionary where lower(table_name) like '%user%privs%' order by table_name;

TABLE_NAME                     COMMENTS
------------------------------ ----------------------------------------------------------------------
USER_AQ_AGENT_PRIVS
USER_COL_PRIVS                 Grants on columns for which the user is the owner, grantor or grantee
USER_COL_PRIVS_MADE            All grants on columns of objects owned by the user
USER_COL_PRIVS_RECD            Grants on columns for which the user is the grantee
USER_ROLE_PRIVS                Roles granted to current user
USER_RSRC_CONSUMER_GROUP_PRIVS Switch privileges for consumer groups for the user
USER_RSRC_MANAGER_SYSTEM_PRIVS system privileges for the resource manager for the user
USER_SYS_PRIVS                 System privileges granted to current user
USER_TAB_PRIVS                 Grants on objects for which the user is the owner, grantor or grantee
USER_TAB_PRIVS_MADE            All grants on objects owned by the user
USER_TAB_PRIVS_RECD            Grants on objects for which the user is the grantee

11 rows selected.

SQL>

Views you might be interested in – as they show privileges granted directly to you – are

  • user_sys_privs
  • user_tab_privs
  • user_role_privs
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading