If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Best Approach to RollBack?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-14-09, 00:33
laknar laknar is offline
Registered User
 
Join Date: Jul 2008
Posts: 80
Best Approach to RollBack?

Hi,

I have a parent table and child table in datawarehouse environment(SCD2)
I have unix script(join Query comparing existing with new) to load the Parent table first and child table next.

If the unix script fails in middle how can i rollback.which is the best approach to do that.

Parent table(which have surrogate function)
Child table referencing to the Parent Table.

Please Suggest me
Reply With Quote
  #2 (permalink)  
Old 10-14-09, 03:33
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
On top of my head ([please test first)
- set autocommit off!
- code a commit after succesfull completion

This should do the job. If you can trap an error then code a rollback there, otherwise DB2 will rollback automatically when the connection fails.

But again: do not take my word for it an test it first (should not be too hard).
Reply With Quote
  #3 (permalink)  
Old 10-14-09, 09:49
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
Dr_te is right on the money. Make sure your script checks on the return code prior to issuing a commit statement.
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
  #4 (permalink)  
Old 10-15-09, 08:48
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
Quote:
Originally Posted by Cougar8000
Dr_te is right on the money.
Huh? What? Do I get paid for this?
Reply With Quote
  #5 (permalink)  
Old 10-15-09, 09:55
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
Sure, I will double your pay if you continue this way
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
  #6 (permalink)  
Old 10-16-09, 06:03
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
Quote:
Originally Posted by Cougar8000
Sure, I will double your pay if you continue this way
DUOBLE my pay! Jipeeeee.
2 times $0 (in my case :2 times EUR 0). Now I can feed my children and have a myself.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On