Delta load methodology

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

Delta load methodology

Post by shrey3a »

Hi,

I've source as an SQL server and target as an Oracle.

At end of my job I'm writing the lastJobruntime to a table in oracle. For the delta load I need to extract the data >= lastjobruntime.
I was thinking to extarct the lastjobruntime in hash file and then in constraint have a condition sqlserverTable.updated_on >= hashfile.lastjobruntime.

But the problem is the source has 2 million records and it will extract all the records first and then apply the condition in transformer. Is there is a way where i can filter the records before it comes to transformer stage .

Limitation : I can not create a temp table on SQL server as then I would have queried directly in SQL server enviorment against the lastjobruntime table in SQL.

Thanks in Advance.

Regards
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

Your delta date is stored in the Oracle database, it is easy to retrieve this from a sequence job using a routine. From the routine run the DSExecute Unix command SQLPLUS and pass it the select statement as an argument. This will return the result of the SQL in the command output. Parse this output for the date, convert it to the right format and return it to the calling job.

Do a search for SQLPLUS, I am sure there are threads that demonstrate this.

Now pass the value to the SQL Server extract job as a job parameter. Add it to your SQL Server input stage WHERE clause, eg.
CREATION_DATE > #LASTJOBRUNTIME# OR UPDATE_DATE > #LASTJOBRUNTIME#

Also be aware that you will be missing out on the deletes that are occuring in your SQL Server database. You need some method for capturing deletes (if they are occuring) such as a trigger that populates a delete table.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

And also include an upper cap for the extract period so to know where to start next time.
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

Post by shrey3a »

Hi Vincet,

I've made a job which extarcts the date in correct format in hash file.
Can you please guide how to pass this value job parameter in my main job whare I'm extracting the data from SQl server.

as u said
Now pass the value to the SQL Server extract job as a job parameter. Add it to your SQL Server input stage WHERE clause, eg.
CREATION_DATE > #LASTJOBRUNTIME# OR UPDATE_DATE > #LASTJOBRUNTIME#

Regards,
Munish
vmcburney wrote:Your delta date is stored in the Oracle database, it is easy to retrieve this from a sequence job using a routine. From the routine run the DSExecute Unix command SQLPLUS and pass it the select statement as an argument. This will return the result of the SQL in the command output. Parse this output for the date, convert it to the right format and return it to the calling job.

Do a search for SQLPLUS, I am sure there are threads that demonstrate this.

Now pass the value to the SQL Server extract job as a job parameter. Add it to your SQL Server input stage WHERE clause, eg.
CREATION_DATE > #LASTJOBRUNTIME# OR UPDATE_DATE > #LASTJOBRUNTIME#

Also be aware that you will be missing out on the deletes that are occuring in your SQL Server database. You need some method for capturing deletes (if they are occuring) such as a trigger that populates a delete table.
SriKara
Premium Member
Premium Member
Posts: 30
Joined: Wed Jun 01, 2005 8:40 am
Location: UK

Post by SriKara »

A quick solution i can think of is, use the UTILITYRUNJOB in a transformer stage. Immediately after the Oracle plugin, use the transformer stage, to pick the date value and pass it to the utitlityrunjob.

But running a job from transformer stage is not a good practice from coding standards point of view.

Any better suggestions??
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

Post by shrey3a »

Hi ,

I've a job which writes to Oracle table i.e. the last job run time is written to oracle. In my next job where I extract the data from SQL server so I need to Pass the parameter of my last job run time in that. Can you explain the Utilitylastrun in detail....or there can be other design

Thanks in advance.....

[quote="SriKara"]A quick solution i can think of is, use the UTILITYRUNJOB in a transformer stage. Immediately after the Oracle plugin, use the transformer stage, to pick the date value and pass it to the utitlityrunjob.

But running a job from transformer stage is not a good practice from coding standards point of view.

Any better suggestions??[/quote]
Post Reply