Skip to content

Removing granted Oracle DBMS_JAVA permissions

23 February 2012

Recently I jammed up into Oracle Java permissions trying to remove some wrong given bunch and replace them with correct set.

Following Oracle documentation I tried dbms_java.delete_permission relaying on the given tight and clear descriptions stating:

delete_permission

PROCEDURE delete_permission(key NUMBER)
This method is used to delete a granted permission.

Proud of my action I decided to check the result anyway. Positive about the result I’ve fired

SELECT * FROM USER_JAVA_POLICY p WHERE p.grantee_name = USER;

and … Surprise! Permissions were still there.

Repeating carefully actions didn’t change the result – nothing.

Poking and hunting around for a solution I came across the article How to Java which show me two ways how to complete the task.

begin
  DBMS_JAVA.DISABLE_PERMISSION(59);
  dbms_java.delete_permission(59); 
  commit;
end;

OR

delete from java$policy$ where key in (181, 182, 183, 201);
commit;
alter system flush shared_pool;

Seen once, these solutions might seem obvious, but I wonder two things at least:

First: why oracle documentation does not mention this, something like

This method is used to delete a granted permission. To be deleted permission must be disabled first!

And Second: Why the heck a permission should be disabled before deletion? Once deleted it doesn’t matter whether it is enabled or not.

Anyway. For those failing to delete desired permission do

  1. disable
  2. delete

Good luck.

Advertisements

From → Oracle

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: