Thursday, 24 October 2019

Troubleshoot ACL issues

spool grants.log

PROMPT Ignore any errors in this section if you are using Oracle10g or Oracle XE 11g SE or 12c

WHENEVER SQLERROR continue;
prompt Drop the acl if it exists, we then recreate it fresh.
prompt NB this method may fail to delete an existing acl in 12c but you can 
prompt ignore the error that arises when it tries to recreate it.
declare n number;
begin
  SELECT count(*) into n FROM resource_view WHERE any_path like '/sys/acls/resolve.xml';
  if n = 1 then  
    dbms_network_acl_admin.drop_acl(acl => 'resolve.xml');
  end if;
end;
/

prompt Create the acl. NB this call may fail in 12c if the above code failed to delete
prompt an existing acl. You can ignore the error that arises when it tries to recreate it.
exec dbms_network_acl_admin.create_acl(acl => 'resolve.xml',description => 'resolve acl', principal => '&2', is_grant => true, privilege => 'connect');
prompt If that failed you can ignore the error.

exec dbms_network_acl_admin.add_privilege(acl => 'resolve.xml', principal => '&2', is_grant => true, privilege => 'resolve');
exec dbms_network_acl_admin.assign_acl(acl => 'resolve.xml', host => '*');
PROMPT End ignore errors section

exit

No comments:

Post a Comment