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?
select * from dba_role_privs where grantee = 'SCHEMA_NAME'; All the role granted to the schema will be listed.
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.
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>';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With