在 SSIS 多线程解决方案中发生意外终止。

huangapple go评论72阅读模式
英文:

Unexpected Termination in SSIS multithreading solution

问题

https://key2consulting.com/multithreading-an-ssis-package/ 上我没有找到可以发表评论的地方。但无论如何,当我通过作业运行时,出现了意外终止的情况。如果我在VS中本地运行,一切都正常,当调用的包在其自己的作业中运行时也一切正常。所以问题必须是多线程代码出了问题,因此我开始添加FireInformation事件,每次运行时似乎显示不一致的信息日志记录,所以我已经没有了主意。任何建议都将有所帮助。我的代码与上面的帖子并不完全一样,因为我根据自己的需要进行了改编,正如我所说,当我本地运行时它是有效的。

在ICSPackage.ExecutePackage方法的第一行中,我有一个调用:

bool fireAgain = true;
Dts.Events.FireInformation(1, "ICSPackage", "Thread" + threadInstanceNumber.ToString() + " execution", "", 0, ref fireAgain);

但从未触发。

英文:

Was following https://key2consulting.com/multithreading-an-ssis-package/ I could not see anywhere to post a comment on that specific site anyhow I get Unexpected Termination when I run via a job, all fine if I run locally in VS and all good when the called package is run by itself in its own job. So it must be the multithreading code that is bombing out, so I started adding FireInformation events and every time I run it, it seems to show inconsistent trail of information logs, so I am out of ideas. Any suggestions would be helpful. My code is not exactly the same to the letter as the above post as I have adlibbed for my purposes, and as I said it works when I run locally.
In the first line of the ICSPackage.ExecutePackage method I have a call:

bool fireAgain = true;
Dts.Events.FireInformation(1, "ICSPackage", "Thread" + threadInstanceNumber.ToString() + " execution", "", 0, ref fireAgain);

that never gets fired.

答案1

得分: 1

感谢 @billinkc,如果不是你激发了我接受这个挑战,我可能永远也不会成功。我最终克服了困难,也许将来会帮助其他人克服困难。

学到的两个教训:

  1. 在线程中记录日志没有起作用。
  2. 强制要求的参数确实是强制性的。

在线程中记录日志,就像 Dts.Events.FireInformation(1, "Thread" + threadInstance.ToString(), "Complete", "", 0, ref fireAgain); 那样,一开始没有起作用,然而,永不言败!我通过向ICSPackage添加事件处理程序,这样调用者(主脚本)可以调用事件,从而在其中调用日志事件代码。效果非常好...我非常高兴。我能够从日志中获取错误消息...太棒了...所以当我运行作业时,它引导我思考...

在线程1上执行SSIS目录失败,出现错误:System.Data.SqlClient.SqlException (0x80131904):为了执行此包,您需要为所需的参数指定值。

@#$%^ 大家都有一个愉快的一天!

英文:

Thank you to @billinkc if only that you inspired me to accept the challenge. I finally got over the line and maybe it will help someone else to go over the line as well in the future.
2 lessons learnt:

  1. Logging in a thread did not work
  2. Mandatory required parameters really means mandatory

Logging in a thread as in Dts.Events.FireInformation(1, "Thread" + threadInstance.ToString(), "Complete", "", 0, ref fireAgain); did not work however; never say never! I made it work by adding an event handler to the ICSPackage so the caller (Main Script) can then invoke the event and thus I call the log event code in there. Worked like a charm .. so so happy. I was able to get the error message from the log ... yeeha ... so when I ran my job low and behold it led me to think ...

> The Execution from the SSIS Catalog Failed on Thread 1 with error: System.Data.SqlClient.SqlException (0x80131904): In order to execute this package, you need to specify values for the required parameters.

@#$%^ Have a nice day everyone!!

huangapple
  • 本文由 发表于 2023年2月27日 17:59:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/75578999.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定