Showing posts with label oracle security. Show all posts
Showing posts with label oracle security. Show all posts

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