SSIS Error: Unable to load the package as XML because of package does not have a valid XML format.
Failed to open package file "\\sharepath\ssis\package.dtsx" due to error 0x80070005 "Access is denied.".
Problem:
I was trying to execute the SSIS package through SQL Server Agent and got the error below.
Error Message :
Executed as user: NT Service\SQLSERVERAGENT.
Microsoft (R) SQL Server Execute Package Utility Version 15.0.2000.5 for 64-bit Copyright (C) 2019 Microsoft. All rights reserved.
Started: 4:04:21 AMError: 2023-01-31 04:04:22.02
Code: 0xC0011007
Source: {8819A11A-3A4B-49C5-93C0-1D73E13FB627}
Description: Unable to load the package as XML because of package does not have a valid XML format. A specific XML parser error will be posted.
End ErrorError: 2023-01-31 04:04:22.02
Code: 0xC0011002
Source: {8819A11A-3A4B-49C5-93C0-1D73E13FB627}
Description: Failed to open package file "\sharepath\ssis\package.dtsx" due to error 0x80070005
"Access is denied.".
This occurs when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of specifying an incorrect file name when calling LoadPackage or the specified XML file has an incorrect format.
End ErrorStarted: 4:04:21 AM Finished: 4:04:22 AM Elapsed: 0.062 seconds.
The package could not be found. The step failed.
Hexadecimal & decimal code | Symbolic name | Description |
0xC0011002 -1073672190 | DTS_E_OPENPACKAGEFILE | Failed to open package file "%1" due to error 0x%2!8.8X! "%3". This happens when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of either providing an incorrect file name was specified when calling LoadPackage or the XML file was specified and has an incorrect format. |
0xC0011007 -1073672185 | DTS_E_FUNDAMENTALLOADINGERROR | Unable to load the package as XML because of package does not have a valid XML format. A specific XML parser error will be posted. |
Solution 1:
The SQL Server Agent service account (i.e, in my case NT Service\SQLSERVERAGENT) does not have access to the directory where the SSIS package is present. This issue can be solved by providing Read permission to the service account on the directory where the SSIS package is present.
To get the SQL Server Agent service account, execute the below queries.
-- to get the sql server agent service account
select *
from sys.dm_server_registry
where registry_key LIKE '%SQLSERVERAGENT'
GO
select *
from sys.dm_server_services
where servicename LIKE 'SQL Server Agent%'
Solution 2:
Create a proxy account with credentials which have permission to read from the directory and then run the SQL Server Agent job step as the proxy account.
I hope this solves your issue. Thanks for reading.
Related posts:
Debugging SSIS Errors
Database Administration
SQL Server Management Studio