How to execute dtsx packages through command line

2019-01-11 11:19发布

问题:

when i execute dtsx package through command line i am triggered with the following error saying

1.The connection is not found , the error is thrown by connections collection when the specific connection element is not found

2.Cannot resolve package path to an object in the package "xxxxxxx".Verify that the package path is valid

3.The package path referenced an object that cannot be found , this occurs when an attempt is made to resolve a package path to an object that cannot be found

But this works fine when i run the package through Business Intelligence development studio.

回答1:

Taking a guess here while I wait on an answer to the comment, generally when a package runs fine in BIDS but doesn't work from the commandline, I find it's related to 64/32 bit incompatibility.

Are you using Excel, Access or anything else that under the sheets uses the JET driver? That only works in 32 bit mode.

On a 64 bit OS, by default when you create a new ODBC connection, you'll be creating it in the 64 bit namespace which the 32bit version won't be able to access?

Are you using Informix or UDB/DB2 drivers? I only ever found 32 versions of those.

Running a package from the command line

dtexec is the command line mechanism for running an SSIS package. It comes in 2 flavors for 64 bit OS, both are named dtexec and generally the 32 bit is referenced in the Windows Path environment variable

On a 64 bit OS, the default path to the 64 bit would be "c:\Program Files\Microsoft SQL Server\100\DTS\Binn\DTExec.exe"

Still on 64 bit OS, the path to the 32 version would be "c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\DTExec.exe"

To run a package named FooBar.dtsx that lives in C:\Src\MyProject\MyProject, invocation would be

"c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\DTExec.exe" /file C:\Src\MyProject\MyProject\FooBar.dtsx

If that package lives on SQL Server (DEVSQL01) in the folder MyProject, this would be the call to run the same package.

"c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\DTExec.exe" /SQL \MyProject\FooBar /SERVER DEVSQL01

Edit

To apply a configuration, you need to specify the /CONF option

"c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\DTExec.exe" /file C:\Src\MyProject\MyProject\FooBar.dtsx /CONF C:\FooBar.dtsConfig

Looking at your comments, the only difference between our usage is you have wrapped everything in double quotes. Try it without the preceding and trailing quote.



回答2:

type below text to call SSIS package

dtexec /f /set \package.variables[Variable]; value

Example:- dtexec /f E:\test_package\test_package\Package.dtsx /set \package.variables[id];1

Reference Ways to execute SSIS package



回答3:

The /SQL option is for packages deployed to the MSDB -> servername\StoredPackages\MSDB\