Wednesday, March 16, 2016

ORA-24247: network access denied by access control list (ACL) IN ORACLE 11G

You might face this issue when you will work with SMTP-SERVER for sending EMAIL from ORACLE DATABASE through Oracle packages.

[NOTE:  THIS IS FOR ORACLE 11G]

As of Oracle 11g a new package DBMS_NETWORK_ACL_ADMIN allows fine-grained control over network hosts access using access control lists (ACL) implemented by XML DB

So, whenever you will face this error, you have to give permission to that user for this host and port.  Just execute following statement with SYS user. (before that please change the below highlighted user name and SMTP server name as yours)

BEGIN
   DBMS_NETWORK_ACL_ADMIN.CREATE_ACL (
      acl           => 'smtp-gate-permissions.xml',
      description   => 'Permissions for smtp gate',
      principal     => 'HALIMDBA', ----DB USER NAME WHO WILL SEND THE EMAIL
      is_grant      => TRUE,
      privilege     => 'connect');
   COMMIT;
END;
/



BEGIN
   DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL (acl          => 'smtp-gate-permissions.xml',
                                HOST         => 'SMTP-SERVER-NAME', ----SMTP SERVER NAME OR IP
                               lower_port   => 25, ---THIS DEFAULT PORT
                               upper_port   => NULL);
   COMMIT;
END;
/


-----------------------------------*******************----------------------------------

No comments: