SQL エージェント ジョブを介して呼び出された SSIS パッケージから "返された状態" を追跡する方法を次に示します。運が良ければ、これのいくつかがあなたのシステムに当てはまるかもしれません。
...そして、 SSIS から返される値のホストを取得できるため、面倒になります。SSIS の手順を実行している間にアクションとアクティビティを DB テーブルに記録し、それを参照して問題を解決しようとしました (これは、以下の @Description の由来です)。関連するコードとコメントは次のとおりです。
-- Evaluate the DTEXEC return code
SET @Message = case
when @ReturnValue = 1 and @Description <> 'SSIS Package' then 'SSIS Package execution was stopped or interrupted before it completed'
when @ReturnValue in (0,1) then '' -- Package success or failure is logged within the package
when @ReturnValue = 3 then 'DTEXEC exit code 3, package interrupted'
when @ReturnValue in (4,5,6) then 'DTEXEC exit code ' + cast(@Returnvalue as varchar(10)) + ', package could not be run'
else 'DTEXEC exit code ' + isnull(cast(@Returnvalue as varchar(10)), '<NULL>') + ' is an unknown and unanticipated value'
end
-- Oddball case: if cmd.exe process is killed, return value is 1, but process will continue anyway
-- and could finish 100% succesfully... and @ReturnValue will equal 1. If you can figure out how,
-- write a check for this in here.
最後に、「SSIS の実行中に、プロセスの実行時間が長すぎるために管理者ジョーカーが CMD セッションを (たとえば、タスク マネージャーから) 強制終了した場合」の状況を参照しています。私が知っていることですが、私がこれを書いているとき、彼らは非常に偏執的だったので、私はそれを調べなければなりませんでした...