2

We are creating several SSIS packages to migrate a large database as part of a release cycle. We may end up with about 5-10 SSIS packages.

As we have 4 environments (dev, QA, staging, production, etc.), is there an efficient way to change the destination server for each SSIS package as they go through the different server environments? Ideally, there could be a script that is run that would take as a parameter the server that was needed.

1
  • It can be done many different ways: manually, automatically, through config files, or even programatically. However, none of these could be fairly said to be "easy", especially if you are not already set up to use them and certainly not on your first time trying to do it. Of all these different way, "programatically" is probably the most difficult. Feb 3, 2010 at 23:16

3 Answers 3

5

You could use a configuration file to store the connection strings for the servers. Then as you moved from environment to environment, you would simply change the config file. To simply create a config file, on the control surface of your package,
1) right click and choose Package Configurations from the context menu.
2) Check the box for Enable package configurations if it is not already selected,
3) then Click the Add... button.
4) Click next on the dialog,
5) then add a Configuration file name: and click next.
6) In the Objects View, Under Connection Managers, expand your connection, then expand Properties and check the box next to ConnectionString.
7) Then click next
8) then finish.

You now have an xml file named what you named it in step 5 above. You can edit this file with a text editor and change the connection string to map to whichever server you need it to before each run.

Once created you can share the config file between multiple packages as long as the objects referenced are named the same between the packages.

This is a rudimentary tutorial on configurations, there are many ways of saving configurations of which this is only one. For more information on configurations consult your favorite SSIS book

1
  • Any of the methods of configuration storage in SSIS go through a similar process to the above, just the choices made at each step are different. Your choices include XML (described here), environment variable, registry entry, parent package variable, or Sql Server. In Sql Server you need to define a connection for the table. Feb 3, 2010 at 23:20
2

We use a config table that stores the configurations for the server. But config files work well too. We like the table because we are doing reporting on SSIS package meta data and it's easier to grab this data (along with a lot of other data we store as well) when stored in a table.

4
  • How does the package retrieve the config table info at package execution time?
    – alchemical
    Feb 3, 2010 at 23:03
  • At preexecute time in the package execution, ssis loads the configuration information from whatever method was used to store it. This is true of any of the methods of storing configuration information. If you use the table method described here, you could update the table with sql between runs to move from one environment to the next. If you use the xml method in the other answer, you could replace or edit the file between runs. Feb 3, 2010 at 23:14
  • When we use the table we also use an environment variable as the first configuration. It points to the database where the configs are stored.
    – HLGEM
    Feb 4, 2010 at 14:03
  • HLGEM - Yes, that is my favorite method of configuration, which I have heard called the "Indirect Configuration". For simplicity for this particular problem, I recommended the xml config, but using a SqlServer config indirectly with an environment variable holding the config connection string would work as well. If your environments are on separate networks, the indirect works well, but you have to maintain environment variables on your ssis servers (a small price to pay for flexibility). Feb 4, 2010 at 15:08
1

William Todd Salzman's answer covers most points. I have a couple more to add:

  • Make sure the pacakge ProtectionLevel property is DontSaveSensitive
  • If you are working with different shipping environments, then a SQL Server table as a source for the package configurations is maybe not for you, as you will require one central database containing all the connection strings for all the servers.
  • Having worked with package configurations retrieved from the registry, you will need to be aware that these settings are retrieved from the HKEY_CURRENT_USER hive. This has implications for when the package is run through a SQL Agent Job.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.