Executing single copy of the package
The Problem
Quite often it is necessary to make sure that only one copy of the package is being executed at a given time For example, the package below is being executed every 2 minutes but it might take more than 2 minutes to complete The package is creating text files it is not possible to open the same file twice for writing. So we have to check if the same package is being executed and if not abort the execution
The Solution
This can be easily done by using SQL Data Check Action
Example
SQL Data Check uses SQL scripts to check data in the database. For example, the user may write the following SQL: Select count(*) from table Execution will be successful if the value of the first field of lookup query is more than 0 Execution will fail if the value of the first field of lookup query is equals to 0 or less than 0 or the field type is not numeric.
Using the same approach we can query QUEUE and QUEUE_ACTIONS tables
Select Count(*) as RC from ( select OBJECT_ID from QUEUE WHERE STATUS='R' and OBJECT_ID=3924 union all select OBJECT_ID from QUEUE_ACTIONS WHERE STATUS='R' and OBJECT_ID=3924 )
3924 is a package ID
Status=R means running.
For more technologies supported by our ETL Software see Advanced ETL Processor Versions and Visual Importer ETL Versions
Confused? Ask question on our ETL forum