Wednesday, April 9, 2008

Orphaned Log Records

SQL Server Integration Services contains the SSIS log provider for SQL Server, which can be used to log records to a SQL Server database in the sysdtslog90 table. All sorts of events and information can be recorded during the execution of a package. If you were to turn on logging, but turn off all possible events to be logged, you would still end up with two events being fired and recorded: PackageStart and PackageEnd. These are also the events that are normally used when reporting on how the packages performed. See (SSISEventLogReportPack.exe) for examples of reporting on execution times, success/failure counts, etc.

The bite comes when you have a package that either fails very early in its validation phase, or if you stop the package before it's really started to rev up. If you include all events in your logging, both an OnPreValidate and an OnPostValidate event will occur before the PackageStart event. Because most logging is done based on the PackageStart event, these "orphaned" records will not show up any reports.

To see these records, you can run the following query:
select * from sysdtslog90

where executionid not in
( select executionid from sysdtslog90
where event in ('PackageStart', 'PackageEnd') )
and executionid in
( select executionid from sysdtslog90
where source = 'putPackageNameHere')

You can also use a similar query to delete these records if you don't want them cluttering up your log table.

Version: SQL Server 2005 SP2

No comments: