Results 1 to 13 of 13
  1. #1
    Join Date
    May 2003
    Posts
    369

    Unanswered: question on DB2 logs

    Hi folks,

    We used to run a DB2 log cleanup perl script to clean old logs on DB2 but right now I need to manually run cleanup to free disk space. Sorry to ask such a bone head question but how do I find these DB2 log files that grow and fill up the filesystem on DB2? Do I run the prune command to remove old log files in DB2 or can they be manually deleted? Thanks once again.

    Scott

  2. #2
    Join Date
    Jul 2002
    Posts
    21
    $db2 get db cfg for <databasename>
    you will get directory path in Path of log files
    and First active log file. S???????.LOG filename.
    delete all the files which are less than the first active log file.

  3. #3
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    Deleting all files less than the first active log will jeopardize your recovery ..... So you need all log files created after the earliest backup you are retaining ...

    for example, your backup stategy requires you to retain backups for 1 month, ie 11 May , then doing a list history will show the earliest and the last log .... I would prefer to keep all logs starting with the earlies log ...

    BTW, for this job, there is a script dg_prune available for free download .... It is pretty good and easily customizable ...

    Start with this page :
    http://www.database-guys.com/backrec.html

    Cheers

    Sathyaram

    Originally posted by jay1972
    $db2 get db cfg for <databasename>
    you will get directory path in Path of log files
    and First active log file. S???????.LOG filename.
    delete all the files which are less than the first active log file.

  4. #4
    Join Date
    Mar 2003
    Posts
    343
    And if you backup the database online, you might want to go back a few days before the backyp just to stay covered - in case there was an active transaction which ran through several logs and continues in the log active during the backup.

  5. #5
    Join Date
    May 2003
    Location
    Toronto
    Posts
    29
    How do I know which log file is active? Thanks in advance.

  6. #6
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    The ' First active log file' in the output of your 'get db cfg for <dbname>

    Cheers

    Sathyaram


    Originally posted by ddlldd2000
    How do I know which log file is active? Thanks in advance.

  7. #7
    Join Date
    May 2003
    Location
    Toronto
    Posts
    29
    Thanks, I got it.

  8. #8
    Join Date
    May 2003
    Posts
    369

    log files for one day

    I noticed that under the /db2logs/NODE0000/ directory we have tons of log files for just one day filling up the filesystem. Can I delete all of these except for the last 5 most recent log files without affecting our backup and recovery process?

  9. #9
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    If you have any on-line backups that might be used in a recovery, you would probably need logs that go back to the start of the on-line backup.

    If you take a new off-line backup for the database, and don't need to recover to a prior point in time, you can probably get rid of any logs prior to the off-line backups.

  10. #10
    Join Date
    May 2003
    Posts
    369

    log file storage solution

    I compressed all 500 of the old log files and after compressing them they dont take up much storage. We probably will just offline them to offsite storage for safe keeping. Online backups create a LOT of log files which is why we plan to implement incremental backups eventually instead of constant full online backups.

  11. #11
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    I think IBM really needs to improve the on-line backups, such as not requiring any logs if no updates are made during the backup, or making it easy to lock-out updates during the relatively short duration that a backup usually takes. The current situation is very awkward.

  12. #12
    Join Date
    Mar 2003
    Posts
    343
    I agree. They need to allow the flexibility of an online backup and give it the convenience of an offline(recoverability). There should be a statement to make the database consistent - not just flush logs but flush the bufferpool too - I admit that this would be an expensive transaction, but, for VLDBs this would really help. There should also be an option to suspend any writing to the database - to set the database to a query only mode. If these options were available, it would give users the option to pick and choose what they need to implement in their environments.

  13. #13
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    The option to stop a database/tablespace, and then restart it in read only mode (or utility only mode), run the backup, and then restart in read/write mode, has been available on mainframe DB2 for as long as I can remember. I do not understand why the Windows/Linux/UNIX versions don't support this.

Posting Permissions

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