2017-08-09 116 views
1

我創建一個Oracle觸發器在數據庫表 後插入或更新數據發送郵件插入數據後發送郵件,但沒有發生創建Oracle觸發器在表

`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 246` 
`ORA-06512: at "SYS.UTL_SMTP", line 127` 
`ORA-06512: at "SYS.UTL_SMTP", line 150` 
`ORA-06512: at "TEST.SCRIPT_MAIL", line 9` 
`ORA-04088: error during execution of trigger 'TEST.SCRIPT_MAIL' 

一個錯誤,我使用這個代碼

`CREATE OR REPLACE TRIGGER TEST.SCRIPT_MAIL 
AFTER INSERT 
ON TEST.PARTY_EMAIL 
REFERENCING NEW AS NEW OLD AS OLD 
FOR EACH ROW 
DECLARE 
    v_From  VARCHAR2(80) := '[email protected]'; 
    v_Recipient VARCHAR2(80) := '[email protected]'; 
    v_Subject VARCHAR2(80) := 'test subject'; 
    v_Mail_Host VARCHAR2(30) := '<my domain>'; 
    v_Mail_Conn utl_smtp.Connection; 
    crlf  VARCHAR2(2) := chr(13)||chr(10); 
BEGIN 
v_Mail_Conn := utl_smtp.Open_Connection(v_Mail_Host, 587); 
utl_smtp.Helo(v_Mail_Conn, v_Mail_Host); 
utl_smtp.Mail(v_Mail_Conn, v_From); 
utl_smtp.Rcpt(v_Mail_Conn, v_Recipient); 
utl_smtp.Data(v_Mail_Conn, 
    'Date: ' || to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss') || crlf || 
    'From: ' || v_From || crlf || 
    'Subject: '|| v_Subject || crlf || 
    'To: '  || v_Recipient || crlf || 
    crlf || 
    'some message text'|| crlf || -- Message body 
    'more message text'|| crlf 
); 
utl_smtp.Quit(v_mail_conn); 
EXCEPTION` 
WHEN utl_smtp.Transient_Error OR utl_smtp.Permanent_Error then 
    raise_application_error(-20000, 'Unable to send mail', TRUE); 
END;` 

如何解決呢 請幫助

+0

檢查網絡防火牆.....用戶權限 –

+0

如何檢查網絡防火牆........ ...在我的系統中 – Deepak

+0

只要您的數據良好並且正常工作,您可以嘗試暫時禁用您的Windows防火牆。 –

回答

0

嘗試在這裏看到一個參考:

原因:

No access control list (ACL) has been assigned to the target host or the 
privilege necessary to access the target host has not been granted to the 
user in the access control list. 

操作:

Ensure that an access control list (ACL) has been assigned to the target 
host and the privilege necessary to access the target host has been granted 
to the user. 

network_access_denied_by_access_control_list

+0

本金=>「SYS」, – Deepak

+0

特權=>「連接」 – Deepak

+0

我對訪問控制列表的代碼.............但我不知道如何設置它的值'原則= >「什麼是這裏value''和特權= – Deepak