Thứ Bảy, 28 tháng 11, 2020

FIX LỖI GỬI EMAIL ORA-24247: network access denied by access control list (ACL) trong Oracle Database


-- Gui mail bi loi
begin
    binhtv_owner.send_email_html_m('tranbinh48ca@gmail.com, binhoracle@gmail.com','Test send to 02 emails', 'Body');
end;


ORA-24247: network access denied by access control list (ACL)
ORA-06512: at "SYS.UTL_TCP", line 17
ORA-06512: at "SYS.UTL_TCP", line 267
ORA-06512: at "SYS.UTL_SMTP", line 161
ORA-06512: at "SYS.UTL_SMTP", line 197
ORA-06512: at "binhtv_owner.send_email_html_m", line 5
ORA-06512: at line 2
/
--0 Gán quyen
    grant select any dictionary to binhtv_owner;
    grant select any table to binhtv_owner;
    grant dba to binhtv_owner;
    grant execute on utl_http to binhtv_owner;
    
--1 

SELECT * FROM dba_network_acls;
     
    begin
    dbms_network_acl_admin.create_acl (
    acl => 'utl_mail_new25.xml', 
    description => 'HTTP Access',
    principal => 'binhtv_owner',
    is_grant => TRUE,
    privilege => 'connect',
    start_date => null,
    end_date => null
    );
    end;
    commit;
--2 

SELECT * FROM dba_network_acl_privileges;
    
    begin
    DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(acl => 'utl_mail_new25.xml',
    principal => 'binhtv_owner',
    is_grant => true,
    privilege => 'connect');
    end;
    /
    commit;
    
    begin
    DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(acl => 'utl_mail_new25.xml',
    principal => 'binhtv_owner',
    is_grant => true,
    privilege => 'resolve');
    end;
    /
    commit;
--3 

BEGIN
    dbms_network_acl_admin.assign_acl (
    acl => 'utl_mail_new25.xml',
    host => '88.88.88.88', 
    lower_port => 25,
    upper_port => 25
    );
    END;
    
    revoke select any dictionary from binhtv_owner;
    revoke select any table from binhtv_owner;
    revoke  dba from binhtv_owner;

----------------------
KẾT NỐI VỚI CHUYÊN GIA TRẦN VĂN BÌNH: 📧 Mail: binhoracle@gmail.com ☎️ Mobile: 0902912888 ⚡️ Skype: tranbinh48ca 👨 Facebook: https://www.facebook.com/BinhOracleMaster 👨 Inbox Messenger: https://m.me/101036604657441 (profile) 👨 Fanpage: https://www.facebook.com/tranvanbinh.vn 👨 Inbox Fanpage: https://m.me/tranvanbinh.vn 👨👩 Group FB: https://www.facebook.com/groups/OracleDBAVietNam 👨 Website: http://www.tranvanbinh.vn 👨 Blogger: https://tranvanbinhmaster.blogspot.com 🎬 Youtube: http://bit.ly/ytb_binhoraclemaster 👨 Tiktok: https://www.tiktok.com/@binhoraclemaster?lang=vi 👨 Linkin: https://www.linkedin.com/in/binhoracle 👨 Twitter: https://twitter.com/binhoracle 👨 Địa chỉ: Tòa nhà Sun Square - 21 Lê Đức Thọ - Phường Mỹ Đình 1 - Quận Nam Từ Liêm - TP.Hà Nội #OracleTutorial #OracleDBA #OracleDatabaseAdministration #học oracle database #oca #ocp #oce #ocm

ĐỌC NHIỀU

Trần Văn Bình - Oracle Database Master