Link to home
Start Free TrialLog in
Avatar of rkpavp
rkpavp

asked on

issues with running SSIS packages programmatically

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.
Avatar of carsRST
carsRST
Flag of United States of America image

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

Avatar of rkpavp
rkpavp

ASKER

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?
Another option is calling a stored procedure and having it run the ssis script.

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

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.

Avatar of rkpavp

ASKER

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.
>> 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.  
Avatar of rkpavp

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of carsRST
carsRST
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rkpavp

ASKER

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.
Avatar of rkpavp

ASKER

a possible solution is suggested which I need to improve lot more to get the desired results. thanks for the replies