dbms_java: grant_permission and revoke_permission only take effect after database restart

  • From: "ahmed.fikri@xxxxxxxxxxx" <ahmed.fikri@xxxxxxxxxxx>
  • To: "list, oracle" <oracle-l@xxxxxxxxxxxxx>
  • Date: Mon, 15 Mar 2021 20:10:25 +0100 (CET)

Hi all,
 
does dbms_java.grant_permission requires a database restart?
 
as sys I did following:
 
BEGIN
dbms_java.revoke_permission( 'MYUSER', 'SYS:java.io.FilePermission', 
'/tmp/dummy/*', 'read' );
END;
 
SELECT * FROM dba_java_policy WHERE NAME LIKE '/%' AND grantee = 'MYUSER'
shows that the permission is granted.
 
as MYUSER
 
I run this:
 
DECLARE
v_name VARCHAR2(333):= '/tmp/dummy/myjar.jar';

BEGIN
dbms_java.loadjava( v_name);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(SQLERRM);

END;
 
I get following error:
ORA-29532: Java call terminated by uncaught Java exception: 
java.security.AccessControlException: the Permission 
(java.io.FilePermission /tmp/dummy/s.jar read) has not been granted to 
MYUSER. The PL/SQL to grant this is dbms_java.grant_permission( 'MYUSER', 
'SYS:java.io.FilePermission', '/tmp/dummy/myjar.jar', 'read' )
 
after restarting the database it works.
 
I wonder that but does really dbms_java.grant_permission requires a 
database restart?
 
Best regards
Ahmed


Other related posts: