Troubleshooting SSIS Package Failures in SQL Server Agent Jobs

Troubleshooting SSIS Package Failures in SQL Server Agent Jobs | SQLYARD

Troubleshooting SSIS Package Failures in SQL Server Agent Jobs


SQL Server 2019 • 2022 • 2025 • SSISDB Catalog

SSIS packages that run fine interactively will sometimes fail when called from a SQL Server Agent job. The failure mode is almost always one of three things: a permissions mismatch between the interactive user and the Agent service account or proxy, a configuration problem that only surfaces in the Agent execution context, or a resource or environment issue on the server. This guide walks through a structured diagnostic sequence, starting with the fastest checks and working toward deeper investigation.

SQL Server 2025 deprecation notes. Two SSIS features are deprecated in SQL Server 2025: the legacy SSIS Package Store (packages stored in msdb or the file system and managed through the legacy Integration Services Service) and SSIS 32-bit execution mode. Both remain functional in SQL Server 2025 but will be removed in a future version. New deployments should target the SSISDB catalog with 64-bit execution.
1

Why Agent Execution Differs from Interactive Execution

Beginner

When an SSIS package runs interactively in Visual Studio or SSMS, it runs under the current Windows user’s security context with access to that user’s registry hive, network shares, and credentials. When the same package runs under SQL Server Agent, the execution context changes to either the Agent service account or a configured proxy account. This difference is the root cause of most “works interactively, fails in Agent” problems.

Execution ContextIdentity UsedCommon Gotchas
Interactive (SSMS or Visual Studio)Current Windows userHas access to user’s registry hive, mapped drives, and cached credentials
Agent job, no proxySQL Server Agent service accountNo user registry hive; no mapped drives; may lack SSISDB or file permissions
Agent job with proxyCredential configured in proxyCorrect for most scenarios; verify the credential has the required SSISDB roles and file access
First question when an Agent job fails. Ask: does the Agent service account or proxy account have the same access the interactive user has? File shares, SSISDB roles, linked server permissions, and registry-based package configurations are all user-specific and do not transfer automatically.
2

SSISDB Catalog vs Legacy Package Store

Beginner

The troubleshooting path depends on where the package is deployed. Modern deployments use the SSISDB catalog introduced with SQL Server 2012. Legacy deployments store packages in the msdb database or the file system via the Integration Services Service.

Deployment ModeStorage LocationJob Step TypeError Details Found In
SSISDB catalog (recommended)SSISDB databaseSQL Server Integration Services PackageSSISDB catalog views; Agent job history (summary only)
Legacy: msdb storemsdb databaseSQL Server Integration Services PackageAgent job history; SSIS log provider if configured
Legacy: file system.dtsx file on diskOperating System (CmdExec) using dtexec.exeAgent job history; dtexec output; SSIS log files if configured
SSISDB catalog packages truncate Agent job history. For SSISDB-deployed packages, the Agent job history step message is intentionally brief and directs the reader to check the SSISDB All Executions report. The full error detail lives in SSISDB catalog views, not in msdb job history. Always go to SSISDB first for catalog-deployed packages.
3

Step 1: Read the Agent Job History

Beginner

The Agent job history is the starting point for any failure. In SSMS, expand SQL Server Agent, right-click the job, and select View History. The step detail shows the execution context (the “Executed as user” line), the error code, and the error message.

For SSISDB-deployed packages, the step message will resemble:

Executed as user: DOMAIN\sqlagentsvc. 
The package execution failed. 
The step did not generate any output. 
Process Exit Code 1. 
The step failed.

This is expected and intentional: the full detail is in SSISDB. Note the “Executed as user” identity. If it shows the Agent service account rather than a proxy account, that is the first thing to evaluate.

For legacy file-system packages run via dtexec, the Agent job history captures more output directly, including SSIS error codes such as 0xC0202009 (OLE DB error on a data flow destination) or 0x80040E21 (OLE DB provider-specific error).

4

Step 2: Query SSISDB for Detailed Errors

Intermediate

For SSISDB catalog deployments, the execution detail lives in catalog views. The query below joins catalog.executions, catalog.operation_messages, and catalog.event_messages to return error messages with full context: folder, project, package name, task name, and message source.

-- Recent SSIS errors from SSISDB -- last 7 days
USE SSISDB;
GO

SELECT
    e.server_name,
    e.folder_name,
    e.project_name,
    e.package_name,
    e.executed_as_name,
    e.execution_id,
    e.status,
    om.message_time,
    CASE om.message_source_type
        WHEN 10 THEN 'Entry API (T-SQL/CLR stored proc)'
        WHEN 20 THEN 'ISServerExec.exe (external process)'
        WHEN 30 THEN 'Package-level object'
        WHEN 40 THEN 'Control Flow task'
        WHEN 50 THEN 'Control Flow container'
        WHEN 60 THEN 'Data Flow task'
    END                          AS message_source_type,
    em.message_source_name       AS task_or_component,
    em.package_path,
    om.message
FROM catalog.operation_messages  AS om
LEFT JOIN catalog.executions     AS e
    ON om.operation_id = e.execution_id
LEFT JOIN catalog.event_messages AS em
    ON  om.operation_id       = em.operation_id
    AND om.operation_message_id = em.event_message_id
WHERE
    om.message_type  = 120                            -- errors only
    AND om.message_time >= DATEADD(DAY, -7, GETDATE())
ORDER BY
    om.message_time DESC;
GO
Finding a specific execution ID. To narrow to a single failed run, look up the execution ID first:
-- Find recent failed executions
USE SSISDB;
GO

SELECT TOP 20
    execution_id,
    folder_name,
    project_name,
    package_name,
    executed_as_name,
    start_time,
    end_time,
    status   -- 4 = Failed, 7 = Cancelled, 9 = Stopping
FROM catalog.executions
WHERE status IN (4, 7, 9)
ORDER BY start_time DESC;
GO

Then filter the error query with AND om.operation_id = <execution_id> to isolate one run.

Permissions required. Reading from SSISDB catalog views requires membership in the ssis_admin database role, or explicit SELECT grants on catalog.operation_messages, catalog.executions, and catalog.event_messages. The SQL Server Agent service account or the account reviewing errors will need at minimum ssis_admin or db_ssisoperator.
5

Step 3: Check the SSIS Logging Level

Intermediate

SSISDB catalog executions support four logging levels, configured on the job step or via T-SQL. The default is Basic, which captures errors, warnings, and task-level information. If the error query in Step 2 does not return enough context, increase the logging level to Verbose temporarily.

Logging LevelValueWhat Is Captured
None0No messages logged to SSISDB
Basic1Errors, warnings, task start/end (default)
Performance2Basic plus performance statistics per component
Verbose3All messages including diagnostic and progress events

To set the logging level for a specific execution via T-SQL before it runs (useful for scheduled jobs where the Agent job step cannot be easily modified temporarily):

-- Set logging level to Verbose for the next execution
-- Run this in SSISDB before the job fires, or add as a preceding job step

DECLARE @execution_id BIGINT;

EXEC catalog.create_execution
    @folder_name      = N'YourFolder',
    @project_name     = N'YourProject',
    @package_name     = N'YourPackage.dtsx',
    @execution_id     = @execution_id OUTPUT;

EXEC catalog.set_execution_parameter_value
    @execution_id  = @execution_id,
    @object_type   = 50,           -- execution parameter
    @parameter_name = N'LOGGING_LEVEL',
    @parameter_value = 3;          -- 3 = Verbose

EXEC catalog.start_execution
    @execution_id = @execution_id;
GO
Verbose logging in production. Verbose logging generates significantly more rows in SSISDB and can increase execution time for packages with large data flows. Use it only during active troubleshooting and revert to Basic once the issue is identified.

For legacy packages that do not use SSISDB, logging is configured directly in the package using the SSIS log provider. Open the package in the Integration Services Projects extension for Visual Studio 2022 or 2026, right-click the Control Flow surface, select Logging, choose a log provider (SQL Server, flat file, or Windows Event Log), and select the events to capture: OnError, OnTaskFailed, and OnWarning are the minimum for failure diagnosis.

4

Step 4: Diagnose Permissions and Proxy Accounts

Intermediate

Permissions problems are the single most common cause of the “works interactively, fails in Agent” pattern. There are three layers to check.

SSISDB catalog roles

The account executing the package needs at minimum ssis_admin or db_ssisoperator in SSISDB, plus explicit permission to execute the specific folder and project. Check the current role membership:

-- Check SSISDB role membership for the Agent service account or proxy credential
USE SSISDB;
GO

SELECT
    dp.name        AS principal_name,
    dp.type_desc   AS principal_type,
    dr.name        AS role_name
FROM sys.database_role_members drm
JOIN sys.database_principals   dr ON drm.role_principal_id  = dr.principal_id
JOIN sys.database_principals   dp ON drm.member_principal_id = dp.principal_id
WHERE dr.name IN ('ssis_admin', 'db_ssisoperator')
ORDER BY dp.name;
GO

Proxy accounts

If the SSIS package accesses Windows resources (file shares, UNC paths, registry keys, or external services using Windows authentication), the Agent service account typically lacks those permissions. The correct resolution is to create a SQL Server Agent proxy account linked to a Windows credential that has the required access.

  • In SSMS, expand SQL Server Agent, right-click Credentials under Security, and create a credential mapped to the Windows account with the required permissions.
  • Under SQL Server Agent, expand Proxies, right-click SSIS Package Execution, and create a proxy using that credential.
  • On the Agent job step, set the Run As value to the new proxy account.
  • Verify the proxy account has access to the SSISDB folder/project and to any external resources the package touches.
HKEY_CURRENT_USER registry configurations will fail under Agent. Registry-based package configurations that store values under HKEY_CURRENT_USER are user-specific. When the package runs under the Agent service account or a proxy, that registry hive belongs to a different user and the values will not be found. Migrate these configurations to SSISDB environment variables or SQL Server-based configurations stored in a shared location.

File system access

Flat file sources, destinations, log files, and archive paths all require the executing account to have read or write access to the relevant directories. Mapped drive letters are not available to service accounts. Use UNC paths (\\server\share\file.csv) instead of drive letters, and verify the proxy account has the required share and NTFS permissions.

5

Step 5: Review Package ProtectionLevel

Intermediate

The ProtectionLevel property of an SSIS package controls how sensitive data (connection string passwords, credentials) is stored. An incorrectly set ProtectionLevel is a frequent cause of Agent job failures because the encryption key is tied to the user who saved the package.

ProtectionLevelBehaviorRecommendation
DontSaveSensitiveSensitive values are stripped from the package at save time; must be supplied at runtime via configurations or parametersUse with SSISDB environment variables to supply sensitive values at runtime
EncryptSensitiveWithUserKey (default in some versions)Sensitive data encrypted with the current Windows user’s key; decryption fails when a different user runs the packageAvoid for Agent-executed packages; this is the most common protection level causing Agent failures
EncryptSensitiveWithPasswordSensitive data encrypted with a password supplied at execution timeViable; requires passing the password in the Agent job step command line or via parameter
EncryptAllWithPasswordEntire package encrypted with a passwordHighest security for sensitive environments; requires password at every execution
ServerStoragePackage stored in SSISDB; encryption and access control managed by SQL ServerRecommended for SSISDB catalog deployments; eliminates user-key encryption issues entirely
Recommended production setting. For packages deployed to the SSISDB catalog, set ProtectionLevel to ServerStorage. Sensitive connection values are then stored and encrypted within SSISDB, managed through SSISDB environment variables, and are not tied to any individual user’s encryption key.
6

Step 6: Validate Job Step Configuration

Beginner

Three job step configuration errors account for most setup-related failures.

Wrong job step type

For SSISDB catalog packages, the job step type must be set to SQL Server Integration Services Package. Using Operating System (CmdExec) with dtexec is valid for legacy file-system packages but is not the correct type for catalog deployments. Mixing these causes the step to look for a package in the wrong location.

Package source mismatch

Within the SSIS job step, the Package Source must match where the package lives: SSIS Catalog for SSISDB deployments, SQL Server for msdb-stored packages, or File System for .dtsx files. Verify the folder, project, and package name are correct and have not changed since the job was created.

Job owner permissions

The job owner must have permission to execute the package. If the job owner is a login that no longer has SSISDB access (for example, after a staff change), the job will fail even if a proxy is configured for the step. Check the job owner and update if necessary:

-- Check and update job owner
USE msdb;
GO

SELECT
    j.name        AS job_name,
    l.name        AS owner_login
FROM dbo.sysjobs j
JOIN sys.server_principals l ON j.owner_sid = l.sid
WHERE j.name = N'YourJobName';

-- Update owner if needed
EXEC dbo.sp_update_job
    @job_name  = N'YourJobName',
    @owner_login_name = N'sa';   -- or a service account login
GO
7

Step 7: Investigate Resource Constraints

Intermediate

Large or complex SSIS packages can exhaust server resources, particularly when scheduled during peak load. Resource exhaustion manifests as timeout errors, out-of-memory errors, or unexpected cancellations without a clear SSIS error code.

Disk space

SSIS buffers spill to disk when memory is insufficient. Check free space on the drive configured as the BufferTempStoragePath (defaults to the system temp directory). Flat file destinations and archive tasks also fail silently when the target drive is full.

Memory

Check available memory during package execution using the DMV sys.dm_os_ring_buffers or by monitoring the Windows Performance Monitor counter for Available MBytes. SQL Server Error Log entry 701 (insufficient memory in resource pool) during a package execution confirms memory pressure.

Timeouts

OLE DB connection managers have a default connection timeout of 60 seconds and a command timeout of 0 (no limit) by default, but these can be overridden. Check the ConnectionTimeout and CommandTimeout properties on Execute SQL tasks and OLE DB sources if the failure message includes “timeout expired.”

Schedule long-running packages during off-peak hours. If resource exhaustion is recurring, review whether the package can be scheduled outside peak load windows, split into smaller units, or optimized through row buffer size tuning (DefaultBufferMaxRows and DefaultBufferSize on the Data Flow task).
8

Step 8: Check SQL Server Error Logs and Windows Event Log

Intermediate

When SSISDB query results and Agent job history do not identify the root cause, check the SQL Server Error Log and the Windows Application Event Log for server-level errors occurring at the same time as the package failure.

SQL Server Error Log

In SSMS, expand Management, right-click SQL Server Logs, and select View SQL Server Log. Filter the time window to the package execution period. Look for:

ErrorDescriptionAction
Error 18456Login failed for user; authentication failure at SQL Server levelVerify the credential used by the SSIS connection manager matches the Agent execution account or proxy; check the state code in the error message for the specific reason
Error 701Insufficient memory in resource poolInvestigate memory pressure; consider max server memory setting and Resource Governor configuration
Error 229EXECUTE permission denied on an objectGrant the Agent service account or proxy the required object-level permissions; common for sp_ssis_addlogentry in msdb
Error 1205Deadlock victim; transaction was chosen as the deadlock victimReview data flow task isolation levels and any staging tables the package writes to; reduce contention with the application workload

Windows Application Event Log

Open Event Viewer and filter the Application log for the time window of the failure. Sources to look for: MsDtsSrvr (legacy SSIS service), SQLISPackage (SSIS package execution), SQLAgent, and the operating system itself for disk or memory events. Out-of-memory conditions and network connectivity failures frequently surface here when they do not appear in SSISDB or Agent history.

9

Step 9: Use Extended Events for Deep Tracing

Advanced
SQL Server Profiler is deprecated. Do not use it for new troubleshooting. SQL Server Profiler has been deprecated since SQL Server 2016 and will be removed in a future version. Extended Events (XEvents) is the supported replacement. SQLYARD has a dedicated article on migrating from Profiler to Extended Events.

Extended Events can capture SQL Server-level activity during SSIS package execution, including OLE DB calls, login events, query execution, and wait statistics. This is useful when the SSISDB logs point to a general OLE DB error but do not identify which query or object caused it.

The session below captures failed logins, OLE DB errors, and long-running queries (over 5 seconds) filtered to the SSIS execution window. Write output to an event_file target so it persists after the session ends.

-- Extended Events session for SSIS Agent job troubleshooting
-- Update the file path before running

CREATE EVENT SESSION [SSIS_Agent_Triage] ON SERVER
ADD EVENT sqlserver.error_reported (
    WHERE severity >= 14
),
ADD EVENT sqlserver.sql_batch_completed (
    WHERE duration > 5000000   -- over 5 seconds (microseconds)
),
ADD EVENT sqlserver.rpc_completed (
    WHERE duration > 5000000
),
ADD EVENT sqlserver.login_error (
    ACTION (sqlserver.server_principal_name, sqlserver.client_app_name)
)
ADD TARGET package0.event_file (
    SET filename = N'C:\XEvents\SSIS_Agent_Triage.xel',
        max_file_size = 50,        -- MB
        max_rollover_files = 5
)
WITH (
    MAX_DISPATCH_LATENCY = 5 SECONDS
);
GO

-- Start the session before the job fires
ALTER EVENT SESSION [SSIS_Agent_Triage] ON SERVER STATE = START;
GO

-- After the failure, stop and review the .xel file in SSMS
ALTER EVENT SESSION [SSIS_Agent_Triage] ON SERVER STATE = STOP;
GO

-- Drop when troubleshooting is complete
DROP EVENT SESSION [SSIS_Agent_Triage] ON SERVER;
GO

Open the resulting .xel file in SSMS via File > Open > File, then filter by the timestamp of the package execution. Sort by duration descending to identify slow queries that may have caused timeouts, or filter to error_reported events to find the root SQL Server error.

10

Common Error Codes and What They Mean

Beginner
Error CodeDescriptionMost Likely Cause
0xC0202009OLE DB error on a data flow componentConnection string incorrect for the Agent execution context; destination database unavailable; permissions on destination table
0x80040E21OLE DB provider-specific errorSchema mismatch between source and destination; column truncation; data type incompatibility
0xC020200ECannot open flat fileFile path uses a mapped drive not available to the Agent service account; file does not exist; file locked by another process
0xC0016016Failed to decrypt protected XML nodeProtectionLevel set to EncryptSensitiveWithUserKey; package was saved by a different user than the one executing it under Agent
0xC001400DPackage failed to loadPackage file not found at the path configured in the job step; or SSISDB folder/project/package name mismatch
0xC0047038Data flow buffer manager failedInsufficient disk space for buffer spill files; check temp directory
11

SQL Server 2025 Changes Affecting SSIS

Advanced
Review before upgrading to SQL Server 2025. Several SSIS features are deprecated or removed in SQL Server 2025. Audit existing SSIS deployments before upgrading the SQL Server instance.
ChangeImpactAction Required
Legacy SSIS Package Store deprecatedPackages stored in msdb or managed via the legacy Integration Services Service are deprecatedMigrate packages to the SSISDB catalog
32-bit execution mode deprecatedSSIS 32-bit execution engine is deprecated; SSMS 21 and SSIS Projects 2022 are 64-bit onlyReview any packages that rely on 32-bit OLE DB providers or ODBC drivers; source 64-bit drivers
Microsoft Connector for Oracle removedThe attunity-based Oracle connector is no longer available in SQL Server 2025 SSISReplace with an alternative Oracle connector or OLE DB provider
Hadoop tasks removedHadoop Hive Task, Hadoop Pig Task, and Hadoop File System Task are removedMigrate Hadoop integration to Azure Data Factory or alternative tooling
SDS connection type deprecatedSDS (SQL Server Destination) connection type is deprecated in SQL Server 2025Replace with OLE DB Destination using the SQL Server OLE DB provider

Discover more from SQLYARD

Subscribe to get the latest posts sent to your email.

Leave a Reply

Discover more from SQLYARD

Subscribe now to keep reading and get access to the full archive.

Continue reading