數據流任務封裝了將數據從來源移動到目的地的數據流引擎,並允許使用者在數據移動過程中轉換、清理和修改數據。 將數據流工作新增至封裝控制流程,可讓封裝擷取、轉換和載入數據。
數據流包含至少一個數據流元件,但通常是一組連接的數據流元件:擷取數據的來源;修改、路由或摘要數據的轉換;和載入資料的目的地。
在運行時間,數據流工作會從數據流建置執行計劃,而數據流引擎會執行計劃。 您可以建立沒有數據流的數據流工作,但工作只有在包含至少一個數據流時才執行。
若要將資料從文本檔大量插入到 SQL Server 資料庫中,您可以使用 Bulk Insert 任務,而不是使用 Data Flow 任務和資料流。 不過,大量插入工作無法轉換數據。 如需詳細資訊,請參閱 大量插入任務。
多個流程
數據流工作可以包含多個數據流。 如果工作複製數位數據,而且複製數據的順序並不重要,在數據流工作中加入多個數據流會比較方便。 例如,您可以建立五個數據流,每個數據流都會將數據從一般檔案複製到數據倉儲星型架構中的不同維度數據表。
不過,當一個數據流工作內有多個數據流時,數據流引擎會決定執行順序。 因此,當順序很重要時,封裝應該使用多個數據流工作,每個工作都包含一個數據流。 然後,您可以套用優先順序條件約束來控制工作的執行順序。
下圖顯示具有多個數據流的數據流工作。
日誌條目
Integration Services 提供一組記錄事件,可供所有工作使用。 Integration Services 也提供自定義日誌條目給許多工作。 如需詳細資訊,請參閱 Integration Services (SSIS) 記錄 和 自訂記錄訊息。 資料流工作包含下列自訂日誌項目:
| 記錄項目 | 說明 |
|---|---|
BufferSizeTuning |
指出數據流工作已變更緩衝區的大小。 記錄專案描述大小變更的原因,並列出暫時的新緩衝區大小。 |
OnPipelinePostEndOfRowset |
表示元件已指定其數據列集結尾訊號,而這個訊號是由方法的最後一次呼叫 ProcessInput 所設定。 針對處理輸入的資料流程中每個元件,都會寫入一個條目。 條目包括元件的名稱。 |
OnPipelinePostPrimeOutput |
表示元件已完成對 方法的最後一 PrimeOutput 次呼叫。 視數據流而定,可能會寫入多個日誌條目。 如果元件是資料來源,此日誌條目表示元件已完成處理資料行。 |
OnPipelinePreEndOfRowset |
表示元件即將接收其數據列集結尾訊號,而這個訊號是由方法的最後一次呼叫 ProcessInput 所設定。 系統會為數據流中每個處理輸入的元件寫入條目。 條目包含元件的名稱。 |
OnPipelinePrePrimeOutput |
表示元件即將從 PrimeOutput 方法接收其呼叫。 視資料流而定,可能會寫入多個日誌條目。 |
OnPipelineRowsSent |
報告透過呼叫 ProcessInput 方法提供給元件輸入的行數。 記錄條目包含元件名稱。 |
PipelineBufferLeak |
提供緩衝區管理員消失后,讓緩衝區保持運作之任何元件的相關信息。 如果緩衝區仍在運作中,則緩衝區資源並未釋放,而且可能會導致記憶體流失。 記錄專案會提供元件的名稱和緩衝區的標識碼。 |
PipelineComponentTime |
報告元件在其五個主要處理步驟中花費的時間量(以毫秒為單位)-Validate、PreExecute、PostExecute、ProcessInput 和 ProcessOutput。 |
PipelineExecutionPlan |
報告數據流的執行計劃。 執行計劃提供如何將緩衝區傳送至元件的相關信息。 這項資訊會與 PipelineExecutionTrees 記錄項目結合,說明數據流工作內發生的情況。 |
PipelineExecutionTrees |
報告數據流中配置的執行樹狀結構。 數據流引擎的排程器會使用樹狀結構來建置數據流的執行計劃。 |
PipelineInitialization |
提供工作的初始設定資訊。 這項資訊包括用來暫存 BLOB 資料的目錄、預設緩衝區大小,以及緩衝區中的數據列數目。 視數據流工作的組態而定,可能會寫入多個記錄專案。 |
這些日誌條目提供了豐富的信息,關於您每次執行封裝的程序時數據流任務的執行狀況。 當您重複執行封裝時,您可以擷取一段時間累積下來的重要歷程記錄資訊,這些資訊提供關於工作所執行之處理、可能影響效能的問題,以及工作所處理的數據量的詳細資料。
如需如何使用這些記錄專案來監視及改善數據流效能的詳細資訊,請參閱下列其中一個主題:
來自數據流工作的範例訊息
下表列出非常簡單套件之記錄專案的範例訊息。 封裝使用 OLE DB 來源從資料表擷取資料,使用排序轉換來整理資料,然後使用 OLE DB 目的地將資料寫入另一個資料表。
| 記錄項目 | 訊息 |
|---|---|
BufferSizeTuning |
Rows in buffer type 0 would cause a buffer size greater than the configured maximum. There will be only 9637 rows in buffers of this type.Rows in buffer type 2 would cause a buffer size greater than the configured maximum. There will be only 9497 rows in buffers of this type.Rows in buffer type 3 would cause a buffer size greater than the configured maximum. There will be only 9497 rows in buffers of this type. |
OnPipelinePostEndOfRowset |
A component will be given the end of rowset signal. : 1180 : Sort : 1181 : Sort InputA component will be given the end of rowset signal. : 1291 : OLE DB Destination : 1304 : OLE DB Destination Input |
OnPipelinePostPrimeOutput |
A component has returned from its PrimeOutput call. : 1180 : SortA component has returned from its PrimeOutput call. : 1 : OLE DB Source |
OnPipelinePreEndOfRowset |
A component has finished processing all of its rows. : 1180 : Sort : 1181 : Sort InputA component has finished processing all of its rows. : 1291 : OLE DB Destination : 1304 : OLE DB Destination Input |
OnPipelinePrePrimeOutput |
PrimeOutput will be called on a component. : 1180 : SortPrimeOutput will be called on a component. : 1 : OLE DB Source |
OnPipelineRowsSent |
Rows were provided to a data flow component as input. : : 1185 : OLE DB Source Output : 1180 : Sort : 1181 : Sort Input : 76Rows were provided to a data flow component as input. : : 1308 : Sort Output : 1291 : OLE DB Destination : 1304 : OLE DB Destination Input : 76 |
PipelineComponentTime |
The component "Calculate LineItemTotalCost" (3522) spent 356 milliseconds in ProcessInput.The component "Sum Quantity and LineItemTotalCost" (3619) spent 79 milliseconds in ProcessInput.The component "Calculate Average Cost" (3662) spent 16 milliseconds in ProcessInput.The component "Sort by ProductID" (3717) spent 125 milliseconds in ProcessInput.The component "Load Data" (3773) spent 0 milliseconds in ProcessInput.The component "Extract Data" (3869) spent 688 milliseconds in PrimeOutput filling buffers on output "OLE DB Source Output" (3879).The component "Sum Quantity and LineItemTotalCost" (3619) spent 141 milliseconds in PrimeOutput filling buffers on output "Aggregate Output 1" (3621).The component "Sort by ProductID" (3717) spent 16 milliseconds in PrimeOutput filling buffers on output "Sort Output" (3719). |
PipelineExecutionPlan |
SourceThread0Drives: 1Influences: 1180 1291Output Work ListCreatePrimeBuffer of type 1 for output ID 11.SetBufferListener: "WorkThread0" for input ID 1181CreatePrimeBuffer of type 3 for output ID 12.CallPrimeOutput on component "OLE DB Source" (1)End Output Work ListEnd SourceThread0WorkThread0Drives: 1180Influences: 1180 1291Input Work list, input ID 1181 (1 EORs Expected)CallProcessInput on input ID 1181 on component "Sort" (1180) for view type 2End Input Work list for input 1181Output Work ListCreatePrimeBuffer of type 4 for output ID 1182.SetBufferListener: "WorkThread1" for input ID 1304CallPrimeOutput on component "Sort" (1180)End Output Work ListEnd WorkThread0WorkThread1Drives: 1291Influences: 1291Input Work list, input ID 1304 (1 EORs Expected)CallProcessInput on input ID 1304 on component "OLE DB Destination" (1291) for view type 5End Input Work list for input 1304Output Work ListEnd Output Work ListEnd WorkThread1 |
PipelineExecutionTrees |
begin execution tree 0output "OLE DB Source Output" (11)input "Sort Input" (1181)end execution tree 0begin execution tree 1output "OLE DB Source Error Output" (12)end execution tree 1begin execution tree 2output "Sort Output" (1182)input "OLE DB Destination Input" (1304)output "OLE DB Destination Error Output" (1305)end execution tree 2 |
PipelineInitialization |
No temporary BLOB data storage locations were provided. The buffer manager will consider the directories in the TEMP and TMP environment variables.The default buffer size is 10485760 bytes.Buffers will have 10000 rows by defaultThe data flow will not remove unused components because its RunInOptimizedMode property is set to false. |
許多日誌事件會寫入多個條目,且許多日誌條目中的訊息包含複雜的數據。 若要讓您更輕鬆地瞭解和傳達複雜訊息的內容,您可以剖析消息正文。 視記錄的位置而定,您可以使用 Transact-SQL 語句或腳本元件,將複雜文字分隔成數據行或其他格式,讓您覺得更有用。
例如,下表包含「將數據列提供給數據流元件做為輸入」訊息。 :1185:OLE DB 來源輸出:1180:排序:1181:排序輸入:76”,剖析成數據欄。 當數據列從 OLE DB 來源傳送至排序轉換時,訊息是由 OnPipelineRowsSent 事件所寫入。
| 資料行 | 說明 | 價值觀 |
|---|---|---|
| PathID | OLE DB 來源與排序轉換之間路徑屬性的ID 值。 |
1185 |
| 路徑 | 路徑屬性 Name 的值。 |
OLE DB 來源輸出 |
| ComponentID | Sort 轉換的 ID 屬性值。 |
1180 |
| ComponentName | Sort 轉換之 屬性的值 Name 。 |
排序 |
| InputID | 從 ID 輸入的 屬性到 Sort 轉換的值。 |
1181 |
| InputName | 從 Name 輸入的 屬性到 Sort 轉換的值。 |
排序輸入 |
| RowsSent | 傳送至排序轉換輸入的數據列數目。 | 76 |
數據流工作的設定
您可以在 [ 屬性 ] 視窗中或以程式設計方式設定屬性。
如需如何在 [ 屬性 ] 視窗中設定這些屬性的詳細資訊,請按下列主題:
數據流工作的程式設計設定
如需以程式設計方式將數據流工作新增至封裝及設定數據流屬性的詳細資訊,請按兩下列主題:
相關工作
相關內容
影片、 平衡式數據散發器,technet.microsoft.com。