Tuesday, October 03, 2006

How to compile PL/SQL with a reference to DBA_ROLE_PRIVS when you don't have rights to it...

I have some PL/SQL [Function userHasRole(...) Return Boolean] which references DBA_ROLE_PRIVS. This package function normally is compiled under a schema which does have rights.

Issue: What do you do if you, the lowly Developer, DOES NOT have rights to the [generally DBA-only] DBA_ROLE_PRIVS view?

Fix: Under your user, create a view named DBA_ROLE_PRIVS that references USER_ROLE_PRIVS instead...

CREATE OR REPLACE VIEW dba_role_privs AS
SELECT
  GRANTED_ROLE,
  USER "GRANTEE"
FROM
  USER_ROLE_PRIVS

1 comment:

oracle ebs said...

Thank you so much for providing the solution to this problem. I will now create a view as you have given. I am so excited to have find the solution to this problem. I will share this info with my friends too. Thanks again.