Recently we have switched from Oracle 10g to 11g, and only now I noticed that my mailing function does not work, I now get an error:
ORA-24247: network access denied by access control list (ACL)
So I did a bit of googling and was able to figure out that a new feature in Oracle 11g is now restricting users from using certain packages including utl_smtp. Because I am looking for a quick solution I did not read Oracle documentation, but instead I went looking for easier solutions and came across this tutorial:
https://www.pythian.com/blog/setting-up-network-acls-in-oracle-11g-for-dummies/
I messed around with it a little bit, but because I did not know any better I think I added two seperate configuration .xml files. So first part of my question is - HOW DO I REMOVE IT?
Second question is:
After adding some grants to my user I try to test to see if it worked, but I soon realised it did not:
SELECT DECODE(
DBMS_NETWORK_ACL_ADMIN.check_privilege('netacl.xml', 'TEST1', 'connect'),
1, 'GRANTED', 0, 'DENIED', NULL) privilege
FROM dual;
Returns:
PRIVILE
-------
DENIED
WHY?(THIS HAS BEEN SORTED)
Third part of the question - after reading it was denied I try to fix it like:
BEGIN
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE('netacl.xml' ,'TEST1', TRUE, 'connect');
END;
But that gives me an error:
Ora19279 - XQuery dynamic type mismatch.....(more text meaning nothing to me).
WHY?(I FIGURED OUT, THAT ERROR HAPPENS WHEN YOU GRANT SAME PERMISSION TO SAME USER SECOND TIME)
UPDATE
I have followed the suggested answer by kevinsky below and have learned quite a bit in the process, however I still have a problem. I still get the ORA-24247: network access denied by access control list (ACL). Because I did everything else as suggested, I am starting to think that the problem could be that first configuration file which I added, but cannot remove now because I cannot remember its name. If anyone can help me I would appreciate that very much.
RESULTS OF(I was trying out a few different things so):
select * from dba_network_acls;
Returns
* | 25 | 25 | /sys/acls/utl_smtp.xml| ACLID...
myservername.com | 25 | 25 | /sys/acls/utl_smtp.xml| ACLID...
myDBName | 25 | 25 | /sys/acls/utl_smtp.xml| ACLID...
mailServerDomainName | 25 | 25 | /sys/acls/utl_smtp.xml| ACLID...
mailserver.myDomain.local | 25 | 25 | /sys/acls/utl_smtp.xml| ACLID...
I did this upgrade and it was hours of work. It all has to be redone differently for version 12. Every procedure call must have a commit. The general idea is that you create an access,add details, grant privileges. You must know: