Wednesday, March 21, 2012

Jobs migration between agents

The easiest way to migrate jobs / job streams between the agents without any impact and complete invisible for end users is to use composer commands as below:

1. Create a dump containing all the jobs & the job streams from the source agent (S_FTA):
./<TWS_home>/bin/composer create /tmp/S_FTA_all_jobstreams.txt sched=S_FTA#@
./<TWS_home>/bin/composer create /tmp/S_FTA_all_jobs.txt jobs=S_FTA#@

2. Rename the source (S_FTA) agent with destination agent (D_FTA) and save the files using a different name (D_FTA_all_jobstreams.txt & D_FTA_all_jobs.txt) so you can restore it in case is needed (you can use any text converter you want).

3. Remove the dependencies using temporary files (if the dependencies exist when importing the job streams we will get an error message and the job stream is not imported, and we need to import them again and again until all the dependencies are met, or it will not work at all if we have a close cycle):
cat /tmp/D_FTA_all_jobstreams.txt | grep -v "FOLLOWS" > /tmp/D_FTA_all_jobstreams_no_dependency.txt

4. Import all the jobs:
./<TWS_home>/bin/composer add /tmp/D_FTA_all_jobs.txt

5. Import the job streams without dependency:
./<TWS_home>/bin/composer add /tmp/D_FTA_all_jobstreams_no_dependency.txt

6. Import the job streams with dependency:
./<TWS_home>/bin/composer replace /tmp/D_FTA_all_jobstreams.txt

7. Delete the job and after, the job streams from source agent. The jobs will start to run on the destination agent (D_FTA) starting with the new plan.

Note: If the jobs are scheduled using time zones it may take 48 hours (2 default plans) for a complete move.

No comments:

Post a Comment