Using Windows task scheduler to start multiple instance of Data maskers
I am trying to execute 6 data mask sets in a specific order with some logic. This is because I have 2 SQL plus 1 Oracle databases which have different set of data required to be de-identified. On top of that, there is data needed to be identical across the 3 DBs.
I start with data masking all 3 dbs (with DM SQL and DM Oracle). For the Oracle db, I create staging table from the single source of truth and copy it over to Oracle and sync where it need to be. For the 2 SQL, it is simply done with CrossDB table-to-table rule. So, I need to make sure the data mask sets that masking the 3 dbs is completed before starting the following tasks.
I wrote a PowerShell script to start the first 3 data mask sets as 3 separate PS jobs and wait for them to finish, and check the exit error code to confirm they run successfully or not. If it returns as completed successfully, then start the data sync jobs.
When I wrote the script and manually execute them, it works as expected. With Start-process cmdlet, It starts the 2 DM SQL and DM ORACLE instances one by one. It finished and move on to the next and then complete. I was happy with the result and wanted to move it into a Windows task scheduler.
However, the task failed at the first 3 masking tasks. In specific, it failed on one of the 2 DM SQL instances. The following are the key points from what I observed:
- Powershell starts the 2 DM SQL instance and 1 DM ORACLE instance, but one of the DM SQL instances will terminate after its started with the following 2 error entries in event log:
Application: DataMasker.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.ObjectDisposedException at System.Windows.Forms.Control.MarshaledInvoke(System.Windows.Forms.Control, System.Delegate, System.Object, Boolean) at System.Windows.Forms.Control.Invoke(System.Delegate, System.Object) at N2KCommon.N2KfrmBase.DoTheDelay() at System.Threading.ThreadHelper.ThreadStart_Context(System.Object) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at System.Threading.ThreadHelper.ThreadStart()
Faulting application name: DataMasker.exe, version: 220.127.116.117, time stamp: 0x5c7d22b3 Faulting module name: KERNELBASE.dll, version: 10.0.14393.2791, time stamp: 0x5c5a43dc Exception code: 0xe0434352 Fault offset: 0x000db152 Faulting process id: 0x141c Faulting application start time: 0x01d4d9242c2e978c Faulting application path: C:\Program Files\Red Gate\Data Masker for SQL Server 6\DataMasker.exe Faulting module path: C:\Windows\System32\KERNELBASE.dll Report Id: dcf6229e-3e61-44e3-99c5-bcb6f549a5ee Faulting package full name: Faulting package-relative application ID:
- It seems like there can been only one DataMasker.exe (for SQL) operates at a time.
- Since it is a session within the task scheduler, I can't monitor what happens during the run...