Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2008
    Posts
    94

    Unanswered: 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

  2. #2
    Join Date
    Jan 2009
    Location
    Zoetermeer, Holland
    Posts
    746
    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).

  3. #3
    Join Date
    Nov 2005
    Location
    IL
    Posts
    557
    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.7.0.6 os 6.1.0.0

  4. #4
    Join Date
    Jan 2009
    Location
    Zoetermeer, Holland
    Posts
    746
    Quote Originally Posted by Cougar8000
    Dr_te is right on the money.
    Huh? What? Do I get paid for this?

  5. #5
    Join Date
    Nov 2005
    Location
    IL
    Posts
    557
    Sure, I will double your pay if you continue this way
    --
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows

    DB2 v9.7.0.6 os 6.1.0.0

  6. #6
    Join Date
    Jan 2009
    Location
    Zoetermeer, Holland
    Posts
    746
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •