How to kick a job with the changes in database table

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
akonda
Participant
Posts: 97
Joined: Wed Feb 28, 2007 6:15 am

How to kick a job with the changes in database table

Post by akonda »

My Datastage job has to start running automatically based on database changes.

Example :

The default value is 'N' in table and When Flag is updated to 'Y' in the table, the datastage job need to start running automatically.

pls provide your suggestion on this scenario.

Thanks.
arun
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

What database are you using and what scheduling tool is at your disposal?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
akonda
Participant
Posts: 97
Joined: Wed Feb 28, 2007 6:15 am

Post by akonda »

we are using oracle database and CRON scheduler.
Is it possible without using scheduler. ??
arun
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Well without using a scheduler would be a sloppy solution that would require you to check for the status of the flag every x minutes.
I am not sure with Oracle, but with DB2 and ControlM/Control-O combo, you can have event driven tasks. I am currently implementing the exact same thing. Control-O recognizes the event, trigerrs ControlM which in turn triggers my jobs.
With Oracle, I wasnt too sure so I asked my Oracle DBA here, he said it is possible but he needs some time to dig up the info. As soon as he gets back to me, I can chime in on the specifics.
In the mean time, try searching in google, for event driven tasks.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

You can write a trigger on the table on update, which can run DataStage job.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

My DBA says that in 10g there is a database feature where you can create a "Job" which can run host commands. So if you have Oracle 10g then you can have a trigger on that particular column which will execute this "job", in which you can execute OS level commands.
Prior to 10g, there is no easy way of doing it.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Sreenivasulu
Premium Member
Premium Member
Posts: 892
Joined: Thu Oct 16, 2003 5:18 am

Post by Sreenivasulu »

As Sainath said you can use 'on update triggers' in oracle.. This is generally used for audit or reconcilation purposes but here you can very well use it to trigger jobs

This has been there in oracle since a long time

Regards
Sreeni
akonda
Participant
Posts: 97
Joined: Wed Feb 28, 2007 6:15 am

Post by akonda »

Yes we are using Oracle 10g.
Could you please provide me the navigation and the code to create a job in the trigger to fulfill this requirement.

Appreciated your help .Thanks.
arun
akonda
Participant
Posts: 97
Joined: Wed Feb 28, 2007 6:15 am

Post by akonda »

Can somebody tell me that how to call a datastage job into a database TRIGGER please.?


Thanks
arun
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You're not going to want to trigger the job directly from there unless you're willing to simply launch it without waiting for it to complete or being able to monitor its success or failure. :?

Just how tightly coupled do these processes need to be?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Nagaraj
Premium Member
Premium Member
Posts: 383
Joined: Thu Nov 08, 2007 12:32 am
Location: Bangalore

Post by Nagaraj »

I guess you cannot call a DS job in a DB trigger all you can do is write a shell script where in you can connect to DB query based on the result run your job, and schedule this script on cron or on control-M,

i have no idea about Control-o.

Thanks
vinnz
Participant
Posts: 92
Joined: Tue Feb 17, 2004 9:23 pm

Post by vinnz »

akonda wrote:Yes we are using Oracle 10g.
Could you please provide me the navigation and the code to create a job in the trigger to fulfill this requirement.

Appreciated your help .Thanks.
A simple google search for "oracle 10g event based job" yielded some good starting points ..for example http://www.oracle.com/technology/pub/ar ... html#event
Hope that helps.

If you manage to resolve this, please post your solution if possible for the benefit of others.
Nagaraj
Premium Member
Premium Member
Posts: 383
Joined: Thu Nov 08, 2007 12:32 am
Location: Bangalore

Post by Nagaraj »

The below mentioned article is for the Jobs i.e the PL/SQL programs created in Database. Not suitable for DataStage Jobs.
It would be more complex if we take this as the starting point to solve the above query.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

As I see it you have two choices - to create triggers in the database that eventually invoke dsjob to run the DataStage job, or to have a DataStage job that polls the table in question as part of a sequence, perhaps.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
changming
Participant
Posts: 68
Joined: Wed Oct 13, 2004 3:35 am

create a tastage loop and query the table every few seconds

Post by changming »

If a change is detected, then kick off datastage job.
Post Reply