Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 469
MPritchard Avatar asked Aug 10 '09 14:08

MPritchard


People also ask

How do I check schema privileges?

select * from dba_role_privs where grantee = 'SCHEMA_NAME'; All the role granted to the schema will be listed.

How do I find my Oracle schema?

SQL> select distinct owner from dba_objects; >> Will give you the list of schemas available. select username from dba_users; this output will list all users including sysdba,system and others.


1 Answers

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>';
like image 187
DCookie Avatar answered Oct 15 '22 13:10

DCookie