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
Related
I am using SSIS BIDS 2008 R2. In my solution I have a Parent.dtsx package and there are a few child packages that the Parent package calls. The thing is that some of the Data Flow tasks in my packages (child or Parent) use some csv files that are kept in a folder hierarchy of the packages.
Now I want to distribute my package so I have to deploy it. I have the following quesions -
How to make the my csv files part of the deployment.
All my File Connection Managers have absolute paths. How do I convert them to relative paths? Because this will be an important concern when other consumers try to run the package.
One of the OLE DB connection strings needs to be dynamic. I mean it has to be supplied at runtime when someone will try to run the package using dtexec.
Any help/suggestions/link to resources is greatly appreciated!!
Thanks a bunch
How to make the my csv files part of the deployment.
In the Solution Explorer you'll see there's a folder labelled "Miscellaneous". To add a file to here you need to go to the uppermost node and: Right-click > Add > Existing Item...
All my File Connection Managers have absolute paths. How do I convert them to relative paths? Because this will be an important concern when other consumers try to run the package.
One of the OLE DB connection strings needs to be dynamic. I mean it has to be supplied at runtime when someone will try to run the package using dtexec.
Both of these problems can be resolved by adding a configuration file to your SSIS package.
Open a SSIS package and you'll find the option on the file menu under: SSIS > Package Configurations
You'll be able to modify almost any property of your objects within the package.
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
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.
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
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.