Unschedule Workflow Script

Here is a technique that can be used to unschedule workflows automatically or conditionally. This process uses the pmrep command to unschedule any workflows specified in a CSV file.

I have a copy of this workflow scheduled on our development server using the scheduling option "Run on Integration Service initialization". I do this because any restart of the Informatica service will “re-schedule” unscheduled workflows.

The workflow runs one mapping and calls one command task.

The mapping reads repository table REP_WORKFLOWS where column START_TIME is not NULL, the target output is a flat file (CSV) list consisting of FOLDER ID, FOLDER NAME and WORKFLOW NAME.

The list built by the mapping will contain the workflows that have a schedule but may not necessarily currently scheduled. I could not find a definitive way to list only active scheduled workflows.

The Command task executes a DOS batch file that "reads" the list of workflows and runs “pmcmd unscheduleworkflow” for each entry in the list.

An alternative to using the mapping to build the workflow list is to create an Informatica query that list all Workflows and use the "executequery" pmrep command to build a list.

To Make It Work
After downloading the workflow, review the SQL override code in the mapping’s Source Qualifier, you may need to change it depending on the database for your Informatica repository (My repository resides in MS SQL Server database, and the override code reflects MS SQL Server syntax)

You will need a connection to your repository database, use a READ ONLY user profile to access your repository database.

I use the mapping parameter $$Schema to define the Repository database name or you can hard code it.

Put DOS batch file unschedule.bat in a folder on Informatica server (Windows), you will need to change the workflow's command task to point to the folder where you stored the “bat” file.

The session uses a Parameter file, replace it with your own or change the session’s source connection to use a connection name instead of a parameter.

Optionally schedule the workflow to run on integration startup or run on demand when needed.

Thank you for your support
 or  PayPal

IMPORTANT,  YOU are responsible for backing up your systems before trying or implementing any suggestions from this blog. I do not guarantee 100% accuracy of any code examples. I do not presume to know your system environment(s) or Security requirements; all code examples from this blog should be thoroughly tested before any attempted use on a production system.

0 Response to "Unschedule Workflow Script"

Post a Comment