Solved

issues with running SSIS packages programmatically

Posted on 2010-09-02
10
975 Views
Last Modified: 2013-11-10
Hi, I have spent days trying to solve this problem and still stuck with this and I have posted some questions in various forums, but didn't get satisfactory answers. I have gone through this article already http://blogs.msdn.com/b/michen/archive/2007/03/22/running-ssis-package-programmatically.aspx and here are my issues (I need to run the SSIS package from ASP.NET)

1.option 1 is not suitable for me, because it may recycle worker process if it consumes memory

2.option 2 is also not suitable because of security issues in creating a new process and passing the context to new process looks very complicated for me (according to the support article)

3.option 3 is not suitable because using SQL Server Agent to run SSIS package is not allowed by the company I am working for(I guesss it requires installation of db engine on application server, not sure). but SSIS is installed on the application server.

4.option 4&5 will have the same issues as options 1&2.

I guess the only option left now is to create a windows service and start the service from ASP.NET. but will this allow running multiple packages in parallel? OR is there a better alternate solution for this? please let me know. Thanks.
0
Comment
Question by:rkpavp
  • 5
  • 5
10 Comments
 
LVL 16

Expert Comment

by:carsRST
ID: 33585688
In my opinion, given your limitations, option 2 is your easiest route.   See below.  You can have a VBS script call the command line tool and run your SSIS project.  Using windows scheduler you can set your package to run at any time by calling the VBS file.

To test this, put the code below in a file and save as *.vbs.  Obviously input the path to your package.  Then double click it.  It should run.




Path = "C:\...\mySSISPackage.dtsx"

Set WshShell = WScript.CreateObject("WScript.Shell")

ReturnCode = WshShell.Run("dtexec.exe /FILE """ & Path & """ /MAXCONCURRENT "" -1 "" /CHECKPOINTING OFF  /REPORTING EWCDI  ")

Open in new window

0
 

Author Comment

by:rkpavp
ID: 33585704
thanks for the reply. but the package name is dynamically passed from the web page and the package should be executed on demand from the user, not scheduled by the windows scheduler. how can I do that?
0
 
LVL 16

Expert Comment

by:carsRST
ID: 33585756
Another option is calling a stored procedure and having it run the ssis script.

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=79508

0
 
LVL 16

Expert Comment

by:carsRST
ID: 33585814
Just a follow up to the last post.

With the SP route, you can pass in your SSIS package name as a parameter.  

Using the xp_cmdshell within the SP, you can execute the DTEXEC.exe command tool and run your package.

0
 

Author Comment

by:rkpavp
ID: 33585821
thanks for the reply. in my case the packages are stored on the application server file system, not on the database, will it still work? (also I am not sure if xp_cmdshell option is allowed by the DBAs where I work). I also need an option to kill it if the process hangs (i.e. runs for a long time unexpectedly). I mean kill the specific long running process which is executing a given package, not other dtexec processes which may be running fine.
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
LVL 16

Expert Comment

by:carsRST
ID: 33585853
>> in my case the packages are stored on the application server file system, not on the database, will it still work?

yes - but you have to have permissions to the directory where the package lives.  Just like calling a file that resides on another server.

In any case, I don't see how you get away from using the command line tool.

I guess you could also take my first approach and just remotely kick off the VBS script residing on the app server and have it run the package.  

You have a lot of restrictions.  
0
 

Author Comment

by:rkpavp
ID: 33585896
that's fine. but regarding my second question, lets say I want to kill that process if it is taking a long time (due to some deadlocks or any other reason). how can I do that (with command line or xp_cmdshell option)? I need to kill only the specific process which is taking long time for a given package, not the other processes for other packages which are running fine.
0
 
LVL 16

Accepted Solution

by:
carsRST earned 500 total points
ID: 33585940
I would put in checks within your package, but below is some c# code that will kill processes running remotely.

http://alperguc.blogspot.com/2008/11/c-process-processgetprocessesbyname.html
0
 

Author Comment

by:rkpavp
ID: 33586482
this will help. but as I said earlier, there could be multiple instances of that process running (if multiple packages are running) and I need to kill the right one. anyway thanks for your comments. I will try to figure that out.
0
 

Author Closing Comment

by:rkpavp
ID: 33598373
a possible solution is suggested which I need to improve lot more to get the desired results. thanks for the replies
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now