rollback

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
cosec
Premium Member
Premium Member
Posts: 230
Joined: Tue May 08, 2007 8:10 pm

rollback

Post by cosec »

I am loading from a sequential file to a target database. If there is an error in one of the rows how do I roll back the previous changes ?

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

Post by chulett »

Basically by not committing. Transaction Size is a stage property, so for example, setting it to 0 will get you an 'all or nothing' load.
-craig

"You can never have too many knives" -- Logan Nine Fingers
cosec
Premium Member
Premium Member
Posts: 230
Joined: Tue May 08, 2007 8:10 pm

Post by cosec »

Hi

I tried but it still commits the previous rows.

I set the trasaction isolation to - uncommitted read
and the array size =1 and transaction siz = 0

How do I make it to roll back ?
chulett wrote:Basically by not committing. Transaction Size is a stage property, so for example, setting it to 0 will get you an 'all or nothing' load. ...
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Your job must abort to roll back transactions - is that happening?
-craig

"You can never have too many knives" -- Logan Nine Fingers
cosec
Premium Member
Premium Member
Posts: 230
Joined: Tue May 08, 2007 8:10 pm

Post by cosec »

it does abort....
i am trying it with three test rows...the second row has the error.

when i run it the first row commits....the rows per transaction have been set 0.

any suggestions ? thanks for your input
chulett wrote:Your job must abort to roll back transactions - is that happening? ...
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Where - exectly - are you setting the rows per transaction property value?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
cosec
Premium Member
Premium Member
Posts: 230
Joined: Tue May 08, 2007 8:10 pm

Post by cosec »

I am setting it at the ODBC stage
ray.wurlod wrote:Where - exectly - are you setting the rows per transaction property value? ...
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Something is not as you've stated - if the job finishes in an Aborted status, any uncomitted rows will be rolled back. So either it isn't really aborting or you are actually comitting the rows. You need to help us figure out what is actually going on.
-craig

"You can never have too many knives" -- Logan Nine Fingers
cosec
Premium Member
Premium Member
Posts: 230
Joined: Tue May 08, 2007 8:10 pm

Post by cosec »

Hi
Thanks for the efforts: I am sorry the status was a 'warning'

As stated earlier these are my settings:
I have a sequential file that needs to be loaded in to a target Database(using an ODBC stage).

The sequential file contains three rows. In the second row I created an error( placed a character value to be loaded to a numric column)

The stage setting are as follows:
Transaction handling-
rows per transaction = 0 parameter array size = 1
isolation level = none ( I have tried all the different options and no success)

the update action is "Clear the table and insert rows"


After run:
The target has two rows excluding the row that had the error. Only that row which contained the error rolled back but not the rest.

how do i make it to abort so that I can achieve my desired result that is rollback all changes ?

chulett wrote:Something is not as you've stated - if the job finishes in an Aborted status, any uncomitted rows will be rolled back. So either it isn't really aborting or you are actually comitting the rows. You need to help us figure out what is actually going on.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Your 'bad' record wasn't 'rolled back', it was never accepted by the database. Rolled back imples it went into the database and then some other error cause all current 'good' but uncomitted work to be undone.

How do you make it abort? If you were using a native stage rather than ODBC, there's usually a 'Treat Warnings as Fatal' option, from what I've seen. In ODBC there is an Errors tab, but it's only there for Stored Procedures or if you've managed to leave the Update Action blank.

Otherwise you need to build a reject link and set it to Abort After X rows go down it - in your case, 1 I would think. Either that or set your Warning Limit at runtime to 1 rather than taking the default of 50 or Unlimited. In either case, the job will Abort once either of those conditions are met.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Two jobs. The first one checks for errors and loads the result into a staging area (a text file would do). The second loads from there into the target table, but is only executed if the first succeeds (reports no warnings or errors). That control you can institute using a job sequence containing two Job activities with an OK trigger between them.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rafik2k
Participant
Posts: 182
Joined: Wed Nov 23, 2005 1:36 am
Location: Sydney

Post by rafik2k »

Code: Select all

The sequential file contains three rows. In the second row I created an error( placed a character value to be loaded to a numric column) 
It seems second row never went into database using odbc.
May be DataStage ifself throws that error for second row.
That is why rollback not happening in your case.

What is log information you are getting :?:
Post Reply