[Oracle] ORA-24247: network access denied by access control list(ACL)

tolilong發表於2016-03-29
利用utl_smtp傳送郵件的時候,會出現如下錯誤,具體方法如下:
ORA-20001: The send mail was error
ORA-24247: network access denied by access control list(ACL)

解決方法如下:
BEGIN
 DBMS_NETWORK_ACL_ADMIN.CREATE_ACL (
  acl          => 'email_server_permissions.xml',
  description  => 'Enables network permissions for the e-mail server',
  principal    => 'MON',
  is_grant     => TRUE,
  privilege    => 'connect');
END;
/


BEGIN
DBMS_NETWORK_ACL_ADMIN.assign_acl (
    acl         => 'email_server_permissions.xml',
    host        => 'smtp.xxxxx.com', --SMTP伺服器地址
    lower_port  => 25,
    upper_port  => NULL);
  COMMIT;
END;
/

SELECT host, lower_port, upper_port, acl FROM dba_network_acls;
SELECT acl,principal, privilege, is_grant, TO_CHAR(start_date, 'DD-MON-YYYY') AS start_date, TO_CHAR(end_date, 'DD-MON-YYYY') AS end_date
       FROM dba_network_acl_privileges;
 
  
BEGIN
  DBMS_NETWORK_ACL_ADMIN.drop_acl(acl => 'email_server_permissions.xml');
  COMMIT;
END;
/

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24237320/viewspace-2071990/,如需轉載,請註明出處,否則將追究法律責任。

相關文章