Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2008
    Toronto, Canada

    Unanswered: first active log

    v9.7 FP5.

    I thought I knew this well...

    I connect to the db and check the 'first active log':

    > db2 get snapshot for database on TEST | grep -i 'first active'
    File number of first active log = 144

    > db2 get db cfg for TEST | grep -i 'first active'
    First active log file = S0000144.LOG

    Create a table, insert one row and commit. There is nothing holding the active log space.

    > db2 get snapshot for database on TEST | grep -i oldest
    <nothing is displayed>

    From another session, I execute ARCHIVE LOG command. Log 144 gets truncated and archived (confirmed from list history, db2diag.log and db2adutl). However, the 'first active log' displayed by get db cfg / db snapshot is still 144. I issue another ARCHIVE LOG command. Log 145 gets truncated and archived, but the first active log is still 144.

    db2pd -logs shows:

    > db2pd -d TEST -log

    Database Partition 0 -- Database TEST -- Active -- Up 0 days 00:07:32 -- Date 09/28/2012 16:27:56
    Current Log Number            146
    Pages Written                 0
    Cur Commit Disk Log Reads     0
    Cur Commit Total Log Reads    0
    Method 1 Archive Status       Success
    Method 1 Next Log to Archive  146
    Method 1 First Failure        n/a
    Method 2 Archive Status       n/a
    Method 2 Next Log to Archive  n/a
    Method 2 First Failure        n/a
    Log Chain ID                  0
    Current LSN                   0x000002762D780010
    Address            StartLSN         State      Size       Pages      Filename
    0x0770000070069570 00000275CBD00010 0x00000000 200000     2          S0000144.LOG
    0x0770000070069DD0 00000275FCA40010 0x00000000 200000     1          S0000145.LOG
    0x077000007006A630 000002762D780010 0x00000000 200000     200000     S0000146.LOG
    0x077000007006AE90 000002765E4C0010 0x00000000 200000     200000     S0000147.LOG
    0x077000007006B6F0 000002768F200010 0x00000000 200000     200000     S0000148.LOG
    0x077000007006BF50 00000276BFF40010 0x00000000 200000     200000     S0000149.LOG
    0x077000007006C7B0 00000276F0C80010 0x00000000 200000     200000     S0000150.LOG

    Only when I terminate my connection (the only user connection), the first active log value changes to 146.

    > db2 get db cfg for TEST | grep -i 'first active'
    First active log file = S0000146.LOG

    Does anyone know the first active log values doesn't change after it gets truncated/archived?

  2. #2
    Join Date
    Jun 2003
    Toronto, Canada
    Provided Answers: 1
    Active logs are the ones required for crash recovery. It is conceivable that some or all of the changes made in your transaction are not flushed to disk yet, and if the instance crashed at this point, log 144 would still be needed for recovery. Archiving a log file just means that no new records will be added to it.

    How's that for an explanation?
    "It does not work" is not a valid problem statement.

  3. #3
    Join Date
    Aug 2008
    Toronto, Canada
    I think you're right. I thought ARCHIVE LOG would flush dirtry pages from the bufferpool... Flushing the bp worked - active log value changed.

    My test results attached.

    I suspect that the active log value staying the same causes backup to TSM to timeout (when it tries to retrieve the logs - not sure why it has to go to TSM instead of getting it from disk??). Will check again.

    Attached Files Attached Files

Posting Permissions

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