How do I make SSIS (dtexec) use an alternate config file? - configuration

I've configured my SSIS configuration to load from an XML file. When I run the package with dtexec, I specify a different configuration file for each country I'm processing. In Visual Studio I specified this as France.dtsConfig (I have to choose one and this was the first one).
When I run the package with dtexec /FILE Import.dtsx /Reporting V /ConfigFile "C:\Italy.dtsConfig" I still see the output telling me that "The package is attempting to configure from the XML file France.dtsConfig".
I thought I could override the configuration by providing a different dtsConfig file for each country. Is this possible? What am I doing wrong?

I am using SQL Server 2008 R2 and I was getting the same issue with the Configuration override apparently being ignored. I found the trick I needed was to remove the XML config setting from the package (Package Configurations), and then when running the package the XML configuration file you specify is applied. There is however no message emitted about using the file (and since you removed the XML configuration definition from the package, that message is also not emitted).
MSDN has an explanation (go to section "Understanding How SSIS Package Configurations Are Applied at Run Time") that at first didn't make sense to me, but after finding that not having an XML configuration file defined gives the desired result, I can see what it is trying to say.
In my case I was using the XML file to set the instance name of the server on which the [SSIS Configurations] table was found. At design time this was DEVServer in the connection manager object, and I want to override the value to TESTSvr. Following the rules:
"The utility applies the configurations that were specified in the package at design time and in the order that is specified in the package." So the value DEVServer is loaded from the package.
"The utility then applies any options that you specified on the command line." The value in my XML file (TESTSvr) is now loaded. I can supply any filename I like here, and it will be loaded (be it France or Italy).
"The utility then reloads the configurations that were specified in the package at design time and in the order specified in the package. ... The utility uses any command-line options that were specified to reload the configurations." Note the second part of the rule, about using the command line values. Since we currently have set the server to TESTSvr, this value is now used to load the other configuration values from the [SSIS Configurations] table that you want.

I don't have a reference to an article that documents this behaviour, but I have confirmed it. If the file specified as the configuration file in the package configurations is available at run time, it will be used in preference to the one specified on the command line.
In my experience and my opinion, this is contrary to normal behaviour where specifying something in a command should override the built-in default.
To use the configuration file specified in the dtexec command, rename or delete the file that is specified in the Configuration String of the XML configuration file in the Package Configurations Organiser.

Found a way!
In the designer simply uncheck the "Enable package configurations" option under SSIS -> Package Configurations, and save.
dtexec will still honour the supplied configuration file on the /conf switch, but it will no longer attempt to use the design time configuration file even if is accessible.
I still agree that this is strange behaviour, and that the /conf should override design time settings no matter what.

This should work
/CONFIGFILE "C:\Italy.dtsConfig" /REPORTING V
Specify the complete config file location within double quotes
Edit :
When you have deployed your package in MSDB then the command to execute the package is
DTEXEC /SQL "\Package.dtsx" /SERVER "Server Name"
/CONFIGFILE "C:\Italy.dtsConfig" /REPORTING V
Else if you have deployed in File System then
DTEXEC /f "Physical Package Location"
/CONFIGFILE "C:\Italy.dtsConfig" /REPORTING V
Check whether you are pointing to the correct package
MSDN
You can use the /ConfigFile option to load additional configurations
at run time that you did not specify at design time. However, you cannot
use the /ConfigFile option to replace configured values that you also
specified at design time

Related

Use multiple XML Configuration file for same package in ssis

I have a situation where I need use multiple XML config file to execute the same package to pass different database and server credentials. So the question is, is there any way for a SSIS package to use more than one config file? If so, how can it be achieved?
Any help is appreciated.
You can use the /ConfigFile option of the dtexec.exe utility to specify a a XML configuration file at run time. NOTE THAT you cannot use the /ConfigFile option to replace configured values that you also specified at design time.
See the DTExec documentation here:
http://technet.microsoft.com/en-us/library/ms162810(v=sql.105).aspx
And the SSIS package configuration documentation here:
http://technet.microsoft.com/en-us/library/ms141682(v=sql.105).aspx

where to set the package password property

I have an SSIS package with protection level - EncryptSensitiveWithPassword and I can execute this package with in the BIDS.
While trying to deploy to file system using the Package Deployment Wizard I receive the error
The protection level of the package requires a password but the
package password property is empty
Where should I set this password? (In BIDS in the designer I have set this password and while trying to open the project it even asks me for the password) So for deployment is there a another property to set?
This error is generally caused due to the property PackagePassword being empty in your configuration. Kindly check it and if it's not set, set it.
Also change the protection level to DontSaveSensitive after opening the package using the password. Then add the packages to your solution and once you are done, make the protection level as SaveSensitiveWithPassword.
Try deploying your package with these settings.
Reference:Securing your SSIS Packages
As per the answer by user2339071, if you don't have any passwords in your connections (i.e. you use windows trusted security) then you don't actually need a password.
But, assuming you do... (perhaps you could calrify in the original question):
My understanding is that the package password is basically specified at runtime, not deployment time.
When your DTSX file exists in the file system (after deploying it or copying it there directly), then you need to execute it somehow and that's where you specify the package password.
For example if you use SQL Agent to run your package you will find a field in the job to enter that package password. If you use DTEXEC.EXE directly, there is a switch in there for your package password also.
Personally I don't use the package deployment wizard, I just copy the DTSX file to the target file location.
Set or change the protection level of the package or packages by using a command similar to the one of the following examples:
The following command sets the ProtectionLevel property of an individual package in the file system to level 2, "Encrypt sensitive with password", with the password, "strongpassword":
dtutil.exe /file "C:\Package.dtsx" /encrypt file;"C:\Package.dtsx";2;strongpassword
The following command sets the ProtectionLevel property of all packages in a particular folder in the file system to level 2, "Encrypt sensitive with password", with the password, "strongpassword":
for %f in (*.dtsx) do dtutil.exe /file %f /encrypt file;%f;2;strongpassword
If you use a similar command in a batch file, enter the file placeholder, "%f", as "%%f" in the batch file.
You can also easily set the package password by going into the 'Package Explorer' then right click on the package to go into the properties and set your protection level there.

SSIS Deployment/Setup issue

I have an SSIS 2008 Package that imports some data and then writes out a text file to a local folder on the computer. Everything built, deployed and installed fine, and in my XML configuration file I have a property to set the location of the local folder. I also use an operating system Environment Variable to redirect the location of the XML Configuration file at run time. On my development machine I set the drop-off folder location to C:\Temp, but on the target computer I want this drop-off folder set to E:\SSIS\FileDropOff and I make that configuration setting change at install time. The setup for everything looks fine to me, configuration file looks ok, there were no warnings or errors in the validation check at install time, the Environment Variable is pointing to the right place, and the SSIS Package is installed in the SQL Server MSDB database.
The problem is when the SSIS Package runs on the target computer, it keeps writing the text file to C:\Temp. No matter what I do I can't seem to get it to write to the E:\SSIS\FileDropOff folder. It's like the SSIS Package is stuck on C:\Temp and is ignoring the the XML configuration file setting on the target machine. In the SQL Agent running the SSIS Package I even tried checking the box on the Job Step Properties screen, Data Sources tab and set the Connection String to E:\SSIS\FileDropOff and it still doesn't work.
Is there any place I could be missing where the SSIS Package is looking at C:\Temp? Could there be a cached value someplace that I am not aware of that forcing the package to stick on C:\Temp?
Thanks.
1.) Try restarting your SQL Agent Service. If I remember correctly, it caches environment variables.
2.) Try setting up a package variable and using that to set the connection string instead of the xml file directly.
I believe it's a common mistake when moving between environments (i.e., dev - test - prod) to forget to right click on your package in the new environment and select the latest XML config file. So what's happening is your package is still looking at the old XML config file. You need to right click, and choose to browse and open the one intended for the specific environment.
Make sense?
If you didn't do this you may have unintentionally overwritten your config file.

Configure SSIS logging to log in one file

I know configuring the logging for individual packages thru BIDS. But the drawback I see here is I have to add connectionstring for each tasks and when I have to deplloy these packages on server I have to change log file connectionstring for all packages. Currently I have 32 pacakes and this seems to be time consuming.
Is there any way where I can set up logging for all packages in one place?
You need to look at storing your configuration in either files or sql tables. For instance, in my current project, I have a common configuration file that has all of the items (like logging that are common to the entire project, then I have individual config files for items that are different per package (like individual database connection strings and variables). This allows me to modify the config on deployment without changing the package. SSIS reads in the configuration at runtime. To use logging see the answers in this question:
Is there a way to easily change the server name on several SSIS packages programmatically?
I run some jobs through the DTEXEC dos command and I redirect the output to a .log file.
Example
DTEXEC
/DTS "\File System\Customer_pkg"
/SERVER xxxxx
/MAXCONCURRENT " -1 "
/CHECKPOINTING OFF
/REPORTING V > c:\log\Customer_pkg.log

How to assign a different configuration file during SSIS package runtime?

I am creating a dtsx package that I am running through a bat file. At design time, I created a package configuration that points to a specific location. When I am running the package at run-time, however, I am setting the ConfigFile to a package configuration in a different location. It appears, however, that the package is still running off of the configuration set at design time. Does any one know why this might happen? Any ideas on how I can get the package to run with this different configuration? The following is what I am running in my bat file.
dtexec.exe /f "mypackage.dtsx" /ConfigFile "[some_path]/newconfig.dtsConfig"
If you are using SQL Server 2008, then the order in which package configurations are applied in is as follows:
Design-time configurations
Run-time configurations (i.e. those specified by the /ConfigFile parameter
Design-time configurations again
Therefore any variables set in the design-time config cannot be changed using the /ConfigFile parameter.
The official solution to this is to change the path to the design-time configuration using the /Set parameter.
Details on this can be found here: http://msdn.microsoft.com/en-us/library/bb500430.aspx
I suggest having different sets of .dtsconfig files per environment (DEV, QA, PRD) and to register them as Environment Variables on the machines using setx batch command to define the Variable name and file path.
By using the same Environment Variables names on all environments you will mitigate the need to specify the .dtsconfig file at runtime.