Saturday, July 9, 2011

Common error with SSIS/DTSX Package + SSIS Package Execution from T-SQL using xp_cmdshell and dtexec


I had a scenario where I was invoking SSIS/DTSX package from my stored proc using sp_cmdcell.

Here is a command which I was executing.
 
EXEC xp_cmdshell 'dtexec /SQ Package1'
 
First Error: Could not load package "Package1" because of error 0xC0014062
Description: The LoadFromSQLServer method has encountered OLE DB error code 0x80040E4D
(Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.).
The SQL statement that was issued has failed.
Issue/Resolution: My SQL server and SQL server Agent services was running with this account (NT AUTHORITY\NETWORK SERVICE').
And this account was not added into the administrator group of my machine.
So I added this account into the local administrator group. Another way,
we can resolve this issue by running My SQL server and SQL server Agent services with other Admin account
which also have access on MSDB, Master DB and other local DBs.
 
When you faced the same issue (Login failed for user ‘NT AUTHORITY\NETWORK SERVICE’) in ASP.NET site,
you can refer the following blog.

http://programmers.wordpress.com/2007/10/16/login-failed-for-user-nt-authoritynetwork-service/

 
Second Error: Could not load package "Package1" because of error 0xC001000A.
Description: The specified package could not be loaded from the SQL Server database.
Issue/Resolution: I had not specified the destination server name. I corrected the command and add the /SER attribute with correct server name.
 
EXEC xp_cmdshell 'dtexec /SQ Package1 /SER EDVXGCPSQLCD02\sql2008'
 
Third Error: Could not load package "Package1" because of error 0xC0014062
Description: The LoadFromSQLServer method has encountered OLE DB error code 0x80040E14 (Could not find stored procedure 'msdb.dbo.sp_dts_getpackage'.). The SQL statement that was issued has failed.
Issue/Resolution: Specify the full path for dtexec exe. Final command I could successfully run was :
 
EXEC xp_cmdshell 'C:\"Program Files (x86)\Microsoft SQL Server"\100\DTS\Binn\DTEXEC.exe /SQ Package1 /SER EDVXGCPSQLCD02\sql2008'
Or
EXEC xp_cmdshell 'C:\"Program Files\Microsoft SQL Server"\100\DTS\Binn\DTEXEC.exe /SQ Package1 /SER EDVXGCPSQLCD02\sql2008'
 

No comments:

Post a Comment