How do I check which schemata have been granted EXECUTE permission on an Oracle object?

MPritchard picture MPritchard · Aug 10, 2009 · Viewed 27k times · Source

I need to find out which schemata have already been granted execute permission on a certain object in an Oracle 10g db (in this case, a package). What's the simplest way for me to do this? Is there a built-in function to provide this information?

Answer

DCookie picture DCookie · Aug 10, 2009
SELECT grantee
  FROM all_tab_privs
 WHERE table_name = '<your object name>'
  AND privilege = 'EXECUTE'
  AND grantor = '<object owner>';

Yeah, I know, it says "table_name" but it applies to executable objects as well. The table DBA_TAB_PRIVS works as well. You'll need appropriate permissions (e.g., DBA role, SELECT ANY TALBE) to select from these views and see all the data.

In response to Martin's comment... The above is the easiest way to do what you asked for that I know of. If you want to limit it to packages, try this:

SELECT * FROM all_tab_privs JOIN all_objects ON (table_name = object_name)
 WHERE table_name = '<your object name>'
   AND object_type = 'PACKAGE'
   AND privilege = 'EXECUTE'
   AND grantor = '<object owner>';