Search code examples
sqloracleproceduredefinitionsql-grant

Oracle SQL : Grant View only access to a user A for accessing procedure and function definition of other user B


My requirement is to create a user in oracle 11g database and give the following permissions to this user.

  1. Select any table (this is fixed and i can do this with Select any table privilege)
  2. View definition of all database procedures, functions, packages (unable to do this).
  3. I do not want to give execute permission on any procedure or edit permission or delete/drop permission.

Unable to find any relevant help as everywhere it mentions to grant execute or create any procedure which is risky.


Solution

  • The SELECT ANY DICTIONARY privilege (in earlier versions the SELECT_CATALOG_ROLE role) gives a user privileges to select from any data dictionary table.

    The SELECT ANY DICTIONARY privilege would give a user privileges to write queries against DBA_SOURCE to see the source for any object (or use the DBMS_METADATA package), DBA_VIEWS to see view definitions, etc.

    Cheers!!