Quit SSIS Script task without error or anything - sql

You'd think you find such thing easily on google (or any other search provider) -> not.
I have a SSIS package that runs every 5min.
My package has an error routine in the onError event handler but I don't want it to get in there.
So in fact, the package should just exit / close / kill itself without any warning or error.
Preferably this should be initiated by the script task (vb.net 2008)
Thanks a lot in advance!
L

In your script task (vb.net):
RunningPackage.Stop()
More info here:
http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.runningpackage.stop.aspx#Y0

Related

WLST Scripting Error - Must Activate Changes Bug

I wrote a script to automate Weblogic deployments and during the undeploy and sometimes the deploy part of the script there is an error message that says, "The task cannot be processed further until the current edit session is activated. When this occurs, task processing will continue. The user can exit the deployer tool without affecting the task." When this happens I have to click the "Activate Changes" on the GUI of the admin console for the script to continue and do what I want it to do. Are there any WLST Jython programmers out there that know how to avoid this issue? I am trying to run the script without touching the GUI.
Also, sometimes the State of the managed server changes to 'deploy initializing'. When this happens I know that things are really messed up. I think this happens when I choose the other option "Undo All Changes".
There is a good answer of code for this in this blog
Its best to always do small bits, activate those changes and then proceed to the next task.
When doing an undeploy and deploy, its always better to undeploy, activate the change and then do a deploy and activate again, this way things remain clean else you may have conflicts when activating all changes in 1 go.
and no you dont have to activate from console, you can do from wlst using activate([timeout], [block])
Ensure to commit one transaction per session. This way you would not miss your earlier undeploy/deploy status due to the issue incurred by current deploy/undeploy task. Please find sample code block below.
app-list = [app1 app2 app3 ... app60]
for app in app-list:
edit()
startEdit()
app-path = "<path-to-your-apps>/" + app
deploy(app, app-path, targets=<your-targets>)
print 'deployed ' + app
activate()

Counting how many script in SSIS have been completed

In SSIS package i have multiple scripts running within a job. At any given time i want to read how many scripts have been executed eg, 5/10 (50%) have been completed. Please tell how can i achieve that?
Currently there is no such functionality provided by SSIS to track progress of package execution.
It seems you need to write your own custom utility/application to implement same or use third party one.
There are few ways to do -
Using a switch called /Reporting or /Rep of DTEXEC at the command-line . For example:
DTEXEC /F ssisexample.dtsx /Rep P > progress.txt
2.Implement package logging or customize it.
3 . Implement Event handler on required executable. You can also use OnPipelineRowsSent log of Data Flow Task.
If you want to write your own application then below thread will provide nice starting point.
How do you code the Package Execution Progress window in C#
In my experience, we are using another software to monitor the jobs that are running. http://en.wikipedia.org/wiki/CA_Workload_Automation_AE
You can also try to create your own application that runs on the background that checks that status of your jobs, through checking the logs.

Rethrow an error from within SSIS package

Ive got a 2010 SSIS package which in turn runs other packages. Each package is independent so if one fails the others can still progress. My logic states the next one run on completion of the previous one wether it failed or not
My proble is that when one does error i get a very standard error message which doesn't tell me which one crashed or give me any other clues.
The Integrated Services Dashboard does assist but still lacking basic information. But what i would like is that the package rethrow the error so i can add some more ifnormation to it.
How is this done?
Do i create a script task in the Onerror event for the individual package and add some information of my own before rethrowing the error ?
Any examples that show you what needs to be done ? I still want the other packets to continue to execute.
First thing is that there is no 2010 version of SSIS. You are using Visual Studio 2010 against either 2008 R2 or 2012 but this does not affect the question in any way.
The best way to capture this error information is to log the error information in the child packages. This can be implemented using an SSIS frameworks such as
Free - http://ssisetlframework.codeplex.com/
Commercial product - http://pragmaticworks.com/Products/BI-xPress
Using these frameworks you could easily get the detailed error information that you need without having to modify the control package.

Capture output of regsvr32 in an InvokeProcess TF Workflow Activity

I have a build process setup to build a managed solution using team build. This solution requires an unmanaged component be registered with the server before we build the solution as we interface with it via COM.
The activity (InvokeProcess) I use to register the ComObject looks something like this
regsvr32.exe /s ComObject.ocx
The activity (InvokeProcess) I use to unregister it looks something like this
regsvr32.exe /u /s ComObject.ocx
I have also added the WriteBuildMessage and WriteBuildError to both InvokeProcess activities using stdOutput and errOutput as the message for each action. I also make sure to set the build message importance to high.
It's my understanding that this should redirect the standard output and error output into these logging activities.
The registrion, build, and unregistrion works just fine as long as I do not set the /maxcpucount argument of MSBuild to anything greater than 1.
Once I set it to something greater than 1, our cleanup script at the end of the process fails with this error message when attempting to delete the file in question.
Access to the path '...\ComObject.ocx' is denied.'
I think what's happening is that the unregister activity is failing to unregister ComObject.ocx from the server because MSBuild isn't done with it when it's running across multiple cpu's. Then when I get down to try and delete it from the build server, it's still registered with the system and will fail with the access denied error.
So how do I get regsvr32 output to the stdOutput and errOutput so that the WriteBuildMessage and writeBuildError activities will properly display it in the build logs. If I call regsvr32 with a file that doesn't exist, I see nothing in the build log.
I hope this is makes sense.
Update
The solution to this problem came from a minor tweak of pantelif's solution. What I did was in the if block that throws an exception, I do a WriteBuildError using this as the message:
String.Format("ErrorMessage: {0}", New System.ComponentModel.Win32Exception( System.Runtime.InteropServices.Marshal.GetL‌​astWin32Error() ).ToString() )
This allows me to get the error from regsvr32.exe and write it to the build log.
As for your first question:
I believe it's possible to capture the output, by applying the technique presented by E.Hofman here.
More specifically, if you construct within your 'InvokeProcess' a sequence like presented (pic also from Ewald's post):
& then assign 'WriteBuildMessage' to stamp the 'ErrorMessage', you shall probably end up with getting the output you desire in the generated build log.

Error: Retrieving the file name for a component failed with error code 0x03B98F74

I have simple SSIS ActiveX Script task that is returning with the above error when executing:
I've cut all the code down to just an empty function:
function main
end function
And have ensured the EntryMethod property of the component is main
Any suggestions?
I came across this same error and found that a connection in the activex script was referencing a dsn name that didn't exist. I added the DSN through control panel -> administrative tools -> Data sources (ODBC) and the issue was resolved.
This useful error will be thrown for ANY error in an ActiveX script task (although the error code will vary). In my particular circumstance it only occurred when running under the 64 bit DTEXEC process which made it convoluted to track down. Hopefully of some use to anyone supporting ancient tech.