SSIS - Execute Package Task - file or SQL Server - sql-server

What is the best approach to execute a package within another package?
1.From SQL Server?
In this case, I have to deploy the child package everytime the master package is executed
2. From file
In this case, I am forced to deploy all packages as files (not to SQL Server). Then local package path will not be the same with the package path from the server...

I prefer using from file.
This allows me to use source control for a way to deploy the files. Also in SQL 2012 and higher you can actually do DIFFs on SSIS Package Files.
If you want to try and keep the path the same, maybe you could try a mapped directory on your localhost. That way you could for example create a E: drive that maps to a location on C. This will allow you to keep in sync between local and server locations.

Related

SSIS Project - Catalog Deployment - Environment Variable (for location) accessing file server mapped to a local Z drive - SQL Server Agent issue

I have an SSIS package that reads a number of files using a For Each Loop Container. There are a number
of parameters in this package, and in the Integration Services Catalog in the SSMS, I have created an
environment with many variables for this project/package.
There are a number of environment variables for this package. There is a particular environment variable for Source Location.
While in my DEV setting, I was able to pass the Source Location environment variable as :
C:\Data Repository\Files (in a local machine).
Everything fine. Package runs perfectly, and For Each Loop Container works reads the files.
However, in the PROD setting, I have to use a file server, mapped to a Z drive.
For example:
This PC > Data Repository (\\tordfs) (Z:) > Data Repository > X
becomes
Z:\Data Repository\X
when I copy the path.
Inside the SSIS package, I am able to set the parameter value for Source Location as Z:\Data Repository\X
and the For Each Loop Container works fine from the SSDT/Visual Studio.
Now after the SSIS package/project is deployed to the SSMS Catalog, when I feed Z:\Data Repository\X as a value for the Source Location environment variable, and I Execute the package manually from the Catalog, it works fine.
However, when I use the SQL Server Agent for the above process, I get the following error:
For Each Loop Container:Warning: The For Each File enumerator is empty.
The For Each File enumerator did not find any files that
matched the file pattern, or the specified directory was
empty.
Is there anything I need to do in the For Each Loop Container or the SSIS Catalog to eliminate the above error during execution from the Catalog using SQL Server Agent?
Let me know.
In Windows mapped drives are user-specific. So you would have to map the drive for the account running the package. Instead use a UNC Path in both cases, and not a drive letter.
So something like:
\\tordfs\Data Repository\Files
The account running the package will still need permissions to the share, and permissions to the folder, but won't need a drive letter mount.
I have 2 suggestions:
Try giving read/write permissions to the SQL Database Engine Service account NT SERVICE\MSSQL$<Instance Name> (Where <Instance Name> should be replaced by the installed instance name):
Configure File System Permissions for Database Engine Access
Try to Map the Z:\ network drive within SQL Server:
Make Network Path Visible For SQL Server Backup and Restore in SSMS
Thanks a lot guys. Appreciate it.
I think I have fixed the issue:
In the environment variable, you cannot have Z:\Data Repository\X
The variable must have the values such as this:
\\tordfs\Data Repository\Data Repository\X
While manual execution from SSMS Integration Services Catalog can accept Z:\Data Repository\X as a value of an environment variable,
the SQL Server Agent needs \\tordfs\Data Repository\Data Repository\X
If the SQL Server Agent when reading from the environment in Catalog reads Z:\Data Repository\X,
I get the For Each Loop Container posted above!
This said, I am using a proxy for the SQL Server Agent to resolve other access issues such as moving a file into a folder using the File System Task.

How do I update SSIS package on the server

I have updated the package in BIDS 2005 (I changed the backup routine to save to a different drive) and now I'm trying to get it back on the server (2005). I tried File > Save Copy As... Then ran the job that executes the package and it's still saving to the old drive, thus, my package didn't get saved.
In my opinion always create a deployment utility with your SSIS Project. This is configured under the Project Properties (see below). Once you have configured the project deployment utility, go to your project, find the "bin" folder and double-click the deployment utility. I will walk you through getting your package(s) onto the server really easily.
Good Luck!
The quick and dirty answer is to use dtutil
dtutil /file C:\Src\MyPackage.dtsx /destserver thatDatabase /COPY SQL;MyPackage
I too am a fan of the manifest files but, while probably overkill for your problem, I prefer to use tools that allow for unattended use. I combine the ssisdeploymanifest with a PowerShell script to handle all of SSIS deployments.
Powershell SSIS Deployment and maintenance

Understanding Stored Packages on Integration Services

We have several SSIS packages (in a solution) saved in a directory on the server. The packages are run via a SQL Server Agent job, with 'File system' as the Package source. Packages are not in any way added to 'Integration Services' (the thing you can connect with through the "Connect" button in SSMS). This seems to work fine.
Now I'm trying to understand the practical use and workings of the Integration Services' Stored Packages. It is probably there for a good reason - but I'm not getting it yet (reading several SSIS topics didn't help).
If I open Integration Services and add an existing package to the MSDB folder in Stored Packages, it is added to the msdb System Database of my SQL Server instance. I can then query some information on it from sysssispackages or sysssispackagefolders, and run the package directly.
If I add an existing package to the File System folder in Stored Packages, nothing really seems to happen, except that it also allows me to run it by right-clicking and choosing 'Run Package'.
I feel like I'm missing the important stuff here. My questions are as follows:
What reasons are there for using Integration Services to store
packages in addition to saving them as files on the server?
What exactly happens when you add a package to the 'File System' or
'MSDB' folders in the Integration Services 'Stored Packages' folder?
What's the advantage?
Any pointers/insights very much appreciated!
Here are a few advantages/disadvantages of database stored packages vs file system stored packages:
File System
OS-based file encryption and ACLs
Easier direct access for viewing or editing the package
Generally easier for the developer to manage (to change a package, just replace the file)
SQL Server
Easier access by multiple individuals
Benefits from database security, roles and Agent interaction
Packages get backed up with normal database backup processes
Generally easier for the DBA to manage (he will have the control of what happens with the packages in terms of changes, etc..)
In regards to you second question, a package is an XML file that SSIS can read and execute. On the file based deployment, the SSIS locates the package on your file-system and executes it, on the DB deployment the SSIS locates the package on an MSDB table and executes it. There are no differences in terms of performance whatsoever.
Backup. If packages are on the msdb database, when you backup the database, you backup your packages. Also they can take advantage of SQL Server security and they are not just laying around on a file system.
The advantage is that you dont have to worry about the file path, or that someone will delete the file or move the folder to another location. The package will always be on the the "same place".
Okay, so I misunderstood a lot about the SSIS Package Store and saving packages. Here is what I learned. First of all, 'the thing you can connect with through the "Connect" button in SSMS' (Connect -> Integration Services...) is called the SSIS Package Store.
What exactly happens when you add a package to the 'File System' or 'MSDB' folders in the Integration Services 'Stored Packages' folder? What's the advantage?
File System
If you want to work with the File System folder in the SSIS Package Store, save your packages to the default File System directory (...\Microsoft SQL Server\100\DTS\Packages) or change the root folder for File System to the directory you want to use. (You can change the root by changing the default value of <StorePath>..\Packages</StorePath> in the MsDtsSrvr.ini.xml file, which can be found in the ...\Microsoft SQL Server\100\DTS\Binn directory. Don't forget to restart the Integration Services service after you're done.) When you add a package to this directory, it will appear in the File System folder in the SSIS Package Store. You can then run the package directly from the SSIS Package Store or through an SQL Server Agent job (by choosing SSIS Package Store as the Package Source in the Job Step Properties and then selecting the package).
Editing packages is easy: open the package in the File System directory, edit and save, and the new version will be instantly available through the SSIS Package Store.
Advantages:
Deployment and troubleshooting of packages is easy
Packages are still available when the database engine is down
SQL Server / MSDB
If you want to rely on the msdb database to save your packages, you have to import each package into msdb via the SSIS Package Store. Right-click on the MSDB folder and choose Import Package. This will save the package to the msdb database. You do not need to save the original .dtsx package files afterwards.
Editing packages is a little harder: you have to export the package, edit it and import the package again in SSIS Package Store. Or you can open a new project in BIDS, add the package by right-clicking SSIS Packages and choosing Add Existing Package from SQL Server, edit it and then import the package again in SSIS Package Store.
Advantages:
Security of packages can be tightly configured through database security
Packages will be backed up as the msdb database is backed up
Packages are stored in a central place
What reasons are there for using Integration Services to store packages in addition to saving them as files on the server?
So why would you add a package to the SSIS Package Store and not just run it like we did, by directly referencing to a package.dtsx file from the Job Step Properties window)? It depends: if you want your packages in the msdb database, you need the Package Store, because there is no other way to maintain your packages. If you use the File System, might be that you have a separate 'Development' and 'Deployment' directory and all packages that are ready for deployment can be found through the SSIS Package Store. In each case, the SSIS Package Store provides an easy interface to your packages.
Thanks to João Leal and Diego for your answers!
This one explain the differences better
social.msdn.microsoft.com
File System:
I'm sure you know exactly what the FileSystem option is, but to
complete this section: you can save the package on a physical location
on hard drive or any shared folder with this option, and you should
provide a full qualified path to stored package in the FileSystem
option.
SQL Server:
with this option, SSIS packages will be stored in the msdb database,
in the sysssispackages table. you can separate them in any folder you
want. these folders are virtual folders, which listed in the
sysssispackagefolders table. so with this option ssis package will not
store as physical file. it will store in the msdb database.
SSIS Package Store:
this option is not actually a real option for deployment. why? because
this is a redirection step only. what I mean is that if you choose
this option in the BIDS when you try to save a copy of package ... ,
you will see a tree with a parent "SSIS packages" and two child :
"MSDB" and "File System". if you choose the "MSDB" the package will
save under msdb database same as the sql server option ( previous
option which described ).if you choose the "File System", the ssis
package will store as a physical file with .dtsx extension but in a
folder in this address: \Microsoft SQL
Server\100\DTS\Packages . this is like file system option but you can
not store package at any location , you can store it under a
predefined physical location and of course you can create subfolders
there, but you can not cross the parent to save package any other
place than predefined.

How to transfer a ssis package from Dev to Prod?

I'm trying to move my packages to production using a configuration file, but file is changed only partly and the results go still to DEV server.
Does anybody know what to do?
It is difficult to isolate the cause of your issues without access to your configuration files.
What I suggest you do is make use of package configurations that reference a database within your environment. The databases themselves can then be referenced using environment variables that are unique to each environment.
This a brilliant time saver and a good way to centrally manage the configuration of all your SSIS packages. Take a look at the following reference for details.
http://www.mssqltips.com/tip.asp?tip=1405
Once configured, you can deploy the same identical package between dev and production without needing to apply a single modification to the SSIS package or mess around with configuration files.
You could still have hard-coded connections in your package even though you are using a configuration file. You'll need to check every connection as well.
You can also go the long way around. Go into Integration Services and Export the stored package to its dtsx file. Then you can pull open the file in any good text editor, do a find/replace on your server name and then go back into Integration Services and Import the updated package. Alot of times it's just easier...
everybody and thanks for answering. I'd managed to solve this problem in an ugly way - editing packages on server, but I'd like very much more elegant solution - now I'm trying with environment variable,it seems great, but the wizard that I'm getting is different from that is given in link - and I don't know how to continue.(I'm using VStudio 2005) Besides, I tried configuration file as XML, but package run fails even on the source machine, so I'm stuck !
My personal technique has been to first have a single config file that points the package to a SQL Based Package Config (the connection string to the config DB). Subsequent entries in the package config use the SQL store to load their settings. I have a script that goes into the XML of the package and preps them for deployment to stage or prod. A config file holds the name of the Package Configuration's initial file config entry and where the stage and prod configuration db configruation file is located. The script produces two subdirectories for stage and prod. Each directory has a copy of the solution packages modified for their particular deployment.
Also! Don't forget to turn off encryption in the package files!

SSIS, dtsx and deployment packages

I'm just trying to understand SSIS packages a bit better and how they are deployed. Correct me I'm wrong but for any deployment, I believe there needs to be at least two files a .SSISDeploymentManifest and a .dtsx. The .SSISDeploymentManifest acts as the equivalent windows installer package which points to the .dtsx. The dtsx is the actual package of "stuff" that is referenced as an external file some how when you run the installer. When you install it, the package gets added to a list of ssis packages for that instance.
My further questions:
If i wanted to keep previous version of the same package, can I just copy the bin directories with the two above files and keep separately should I need to roll back to a previous package?
Where are these packages installed to? How does SSIS know where the packagess are?
Correct me I'm wrong but for any deployment, I believe there needs to
be at least two files a .SSISDeploymentManifest and a .dtsx. The
.SSISDeploymentManifest acts as the equivalent windows installer
package which points to the .dtsx. The dtsx is the actual package of
"stuff" that is referenced as an external file some how when you run
the installer. When you install it, the package gets added to a list
of ssis packages for that instance.
Your assumptions are mostly correct. You don't need the deployment manifest, but it can be handy. Also, you don't need to deploy to the SQL Server instance. You have the option to deploy to the file system as well. I'll explain both below.
Regarding your 1st question:
Version Control:
Make sure you're developing and checking in your dtsx packages via visual studio. Label your releases in sourcesafe or whatever version control you're using. If you are checking in and labeling, then you should be able to easily roll back to a previous version. As you mention, you also can just save a copy of your old bin directory but naturally put them in dated subfolders or something. However, this does not take the place of proper version control.
Regarding your 2nd question:
Deployment:
As the other poster states, you first have a decision to make:
a) Deploy packages to the file system
b) Deploy packages to MSDB
There are benefits to each, and everyone has their preference. I have used both, but I prefer the filesystem because it's more transparent, however there is more to maintain.
See this post for much more on this: http://blogs.conchango.com/jamiethomson/archive/2006/01/05/SSIS_3A00_-Common-folder-structure.aspx
The code is in the dtsx package. Generally,in order to make your packages portable you also abstract your connection strings and other configurable information into a config file (.dtsconfig) or environment variable (no file needed). See BOL to learn more about configuration.
The manifest file contains metadata about which dtsx and config files to install. If you open one, you'll see it's a simple readable xml file.
The manifest file makes it easy to hand over to a DBA to deploy (ask them to double-click the manifest file and follow directions, but they'll need instructions.
To me, the manifest file is more useful for deploying to SQL Server than to the file system. Really, all it does is make a copy of the dtsx and config files and puts them where you tell it. You could just as easily instruct the DBA to copy your dtsx files to a common folder on the server, and the config files to another folder on the same server.
Then when you schedule your jobs using SQL Agent, you specify that you're going to run an SSIS package that is stored on the file system and browse to where it's located. If you're using configurations, then there's a tab to specify where the config file is located.
There is so much to know about configuring/deployment/versioning of SSIS packages. But hopefully this will get you started on the right path.
When you export your DTS packages using the Import/Export Wizard in SQL Server you have the option of saving them to SQL Server or locally on the file system.
Regarding the versions of your SSIS packages, you need to query SSISDB to extract the version numbers. It's annoying this kind of info isn't shown directly in the Management Studio but, until it is, someone may find this useful:
SELECT prj.[name] as Project
,pkg.[name] as Package
,pkg.[version_major]
,pkg.[version_minor]
,pkg.[version_build]
FROM [SSISDB].[internal].[packages] as pkg
JOIN [SSISDB].[internal].[projects] as prj
ON pkg.[project_id] = prj.[project_id]
ORDER BY prj.[name]

Resources