Results 1 to 4 of 4

Thread: Logs

  1. #1
    Join Date
    Feb 2007
    Posts
    31

    Arrow Unanswered: Logs

    Hi,
    I used "alter table <tablename> activate not logged initially ".
    When I tired to delete some of the recordes in that table, the logs are get updated. But I think the logs should not get updated because i have alterted the table to NOT LOGGED mode.
    Eg:

    par:/db2t_logs/dbs8140$db2 "select * from bmc.test" bmc.test"

    T1 T2
    ---------- -------
    qwertqS 12.
    qwertqS 12.
    qwertqS 12.
    qwertqS 12.

    4 record(s) selected.

    par:/db2t_logs/dbs8140$ls -ltr
    total 24056
    -rw------- 1 db2t udbadmin 512 Mar 19 2003 SQLLPATH.TAG
    -rw------- 1 db2t udbadmin 4104192 Mar 09 16:57 S0000389.LOG
    -rw------- 1 db2t udbadmin 4104192 Mar 13 15:38 S0000390.LOG
    -rw------- 1 db2t udbadmin 4104192 Mar 13 16:14 S0000388.LOG


    par:/db2t7_logs/dbs8140$db2 "alter table bmc.test activate not logged initially"
    DB20000I The SQL command completed successfully.


    part:/db2t_logs/dbs8140$db2 "select * from bmc.test"
    T1 T2
    ---------- -------
    qwertqS 12.
    qwertqS 12.
    qwertqS 12.
    qwertqS 12.

    4 record(s) selected.

    par:/db2t_logs/dbs8140$db2 "delete from bmc.test where t2=12"
    DB20000I The SQL command completed successfully.

    par:/db2t_logs/dbs8140$ls -ltr
    total 24056
    -rw------- 1 db2t udbadmin 512 Mar 19 2003 SQLLPATH.TAG
    -rw------- 1 db2t udbadmin 4104192 Mar 09 16:57 S0000389.LOG
    -rw------- 1 db2t udbadmin 4104192 Mar 13 15:38 S0000390.LOG
    -rw------- 1 db2t udbadmin 4104192 Mar 13 16:19 S0000388.LOG

    par:/db2t_logs/dbs8140$db2 "select * from bmc.test"
    T1 T2
    ---------- -------

    0 record(s) selected.
    --------------------------------------------------------------------------

    Regards
    Mohan
    Regards
    Mohan

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    You have to do the "ALTER TABLE..." statement and all other statements (DELETE, UPDATE, INSERT) in the same Unit of Work (UOW). A UOW is, in DB2, basically from one commit/rollback to the next. It looks like you are executing you commands from the CLP. This has autocommit ON by default, which commits each statement. You need to turn autocommit off using:
    UPDATE COMMAND OPTIONS using C OFF
    You will also have to manually issue the COMMIT statement when you are done.

    Andy

  3. #3
    Join Date
    Feb 2007
    Posts
    31
    Hi,
    Thanks for your prompt reply..
    db2 "alter table bmc.test activate not logged initially" ,transcation should not be logged in Logs files though if autocommit is on. Is this correct statment..?
    Regards
    Mohan

  4. #4
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Quote Originally Posted by d_mohan81
    Hi,
    Thanks for your prompt reply..
    db2 "alter table bmc.test activate not logged initially" ,transcation should not be logged in Logs files though if autocommit is on. Is this correct statment..?
    No. If autocommit is on, then when you issue the ALTER TABLE command a commit is automatically sent (hence "autocommit") thus ending your UOW. The next statement will begin a second UOW and will be logged.

    Andy

Posting Permissions

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