ERROR at line 1:
ORA-24247: network access denied by access control list (ACL)
ORA-06512: at "SYS.UTL_MAIL", line 654
ORA-06512: at "SYS.UTL_MAIL", line 671
ORA-06512: at line 2
原因:
我們參考了Oracle Doc ID 1209644.1,從Oracle 11gR1 之後由於安全性的提升,我們想要使用 DBMS_NETWORK_ACL_ADMIN package 來操作 Access Control Lists (ACL),用以存取 External Network Services 就會發生這個錯誤訊息。
解決方式:
使用DBA權限執行下面PL/SQL,請記得要將 SCOTT 換成你想要賦予帳號的帳號,帳號有大小寫限制:
BEGIN
-- Only uncomment the following line if ACL "network_services.xml" has already been created
--DBMS_NETWORK_ACL_ADMIN.DROP_ACL('network_services.xml');
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL(
acl => 'network_services.xml',
description => 'NETWORK ACL',
principal => 'SCOTT',
is_grant => true,
privilege => 'connect');
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(
acl => 'network_services.xml',
principal => 'SCOTT',
is_grant => true,
privilege => 'resolve');
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL(
acl => 'network_services.xml',
host => '*');
COMMIT;
END;
/
如果有其他使用者要加入權限,只要執行以下 PL/SQL 即可:
BEGIN
-- For EACH additional user, execute the following code
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(
acl => 'network_services.xml',
principal => 'ANOTHER_USER',
is_grant => true,
privilege => 'resolve');
COMMIT;
END;
/
參考資料:
ORA-24247 Using UTL_TCP, UTL_HTTP, UTL_SMTP And UTL_MAIL With 11gR1 Or Later
(Doc ID 1209644.1)
沒有留言:
張貼留言