Không gửi được tệp nhật ký bằng 'Tác vụ Gửi Thư' từ trình xử lý OnError (Sending the log file using a 'Send Mail Task' from the OnError handler fails)


問題描述

Không gửi được tệp nhật ký bằng 'Tác vụ Gửi Thư' từ trình xử lý OnError (Sending the log file using a 'Send Mail Task' from the OnError handler fails)

I have a package which is configured to create a log file. When an error occurs, I want the OnError event handler for the package to send an email with the log file as an attachement. This fails with the message: 

  

Either the file "C:\Log\blablabla.txt" does not exist or you do not have permissions to access the file.

The file does exist, so the problem must be that I do not have permissions to access it. The package is able to create the file so does this mean the file cannot be accessed because the package is still executing (and therefore writing to the file)? 

Configuration: SQL‑Server 2005. Property DelayValidation == True. 

Edit: I have stumbled across a solution for this problem. It is not enough to set DelayValidation of the task itself to True. You must also set it for the Event Handler (OnError in this case) that contains the task. Doing the same thing for a Send Mail Task that is executed when the package succeeds (so from within Control Flow) still produces the same error.


參考解法

方法 1:

For sending attachments through send email task you should have sysadmin permission.

(by Captain SensibleMaximus)

參考文件

  1. Sending the log file using a 'Send Mail Task' from the OnError handler fails (CC BY‑SA 3.0/4.0)

#sql-server-2005 #ssis






相關問題

可更新查詢所需的最低權限 (Access Project) (Minimum permissions required for an updatable query (Access Project))

Sql中的WHERE,結合兩個快速條件會成倍增加成本 (WHERE in Sql, combining two fast conditions multiplies costs many times)

是否可以重構此語句以刪除子查詢? (Is it possible to refactor this statement to remove the subquery?)

Không gửi được tệp nhật ký bằng 'Tác vụ Gửi Thư' từ trình xử lý OnError (Sending the log file using a 'Send Mail Task' from the OnError handler fails)

擴展 SSRS 中的圖表功能 (Extending chart functionality in SSRS)

sql server 2005 數據庫郵件錯誤(操作已超時) (sql server 2005 database mail error (The operation has timed out))

從.NET應用程序到SQL Server的緩慢調用 (Sporadically Slow Calls From .NET Application To SQL Server)

我需要在 sql 中獲取 alldata whereclause? (i need to get alldata whereclause in sql?)

一種檢查 SQL 2005 中是否存在外鍵的方法 (A way to check if foreign key exists in SQL 2005)

如何在 SSIS 中調用存儲過程? (How do you call a Stored Procedure in SSIS?)

什麼會使桌子“變慢”? (What would make a table "slow?")

可以在這裡使用 Common Table 表達式來提高性能嗎? (Can Common Table expressions be used here for performance?)







留言討論