Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2007
    Posts
    27

    Unanswered: Manual commit for DB2 Import ?

    Hello ,

    I am using DB2 V8 on AIX server
    I have a requirement in which I have 3 DEL file format. I need to import the data from these file in the 3 database tables. But to maintain the database integrity , I need to take care that data for all 3 tables is loaded. If any one table import fails, I need to rollback the changes for the other 2 tables.

    I tried using auto commit off by using +c. But it does not work. Even if I issue rollback, the records are still inserted in the table.

    I guess this is because, Import is not an SQL command rather its a DB2 utility. And it issues a commit statement of its own at the end.

    So is there any way by which I can rollback the import statements.

    Thanks
    Rajesh

  2. #2
    Join Date
    Nov 2005
    Location
    IL
    Posts
    557
    Please show your IMPORT statement.

    If you are running them back to back and not issueing a COMMIT in between you should be able to rollback. IMPORT does nto autocommit. Do you have allow write access ?
    --
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows

    DB2 v9.7.0.6 os 6.1.0.0

  3. #3
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Import will issue a commit after it processes the last row. Why not import them into a staging table first, then if all goes OK, copy the staging table to the production table?

    Andy

  4. #4
    Join Date
    Nov 2007
    Posts
    27
    Hello,
    @Cougar8000 - Its simple import statement
    import from <file> of del
    insert into <tablename>
    i am executing it with db2 +ec option

    @ ARWINNER - Thanks for reply.

  5. #5
    Join Date
    Nov 2005
    Location
    IL
    Posts
    557
    Quote Originally Posted by ARWinner
    Import will issue a commit after it processes the last row. Why not import them into a staging table first, then if all goes OK, copy the staging table to the production table?

    Andy
    Wow, I did not know that. Thanks Andy. I was always under impression that it does not.
    --
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows

    DB2 v9.7.0.6 os 6.1.0.0

Posting Permissions

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