Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2003

    Unanswered: DB2 v7 SQLOGDIR Empty


    Is it possible to empty or clean out the SQLOGDIR for DB2 v7? I have a moderately sized DB of 180Mb but the log directory is pushing 700mb! I have several hundred files in there, is it possible to clear all but the most recent? Obviously I don't want to touch any of them until I am sure it won't have evil repercussions!!



  2. #2
    Join Date
    Jun 2003
    Toronto, Canada
    Provided Answers: 1
    Execute "LIST HISTORY BACKUP FOR <database name>"; you'll probably see a number of entries like this one:
    Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log  Backup ID
     -- --- ------------------ ---- --- ------------ ------------ --------------
      B  D  20040704230001001   N    A  S0022876.LOG S0022876.LOG
    The first column indicates an operation performed; you should be interested in those lines containing "B" (for backup) in this column. Find the latest one and note the earliest log file name.

    This will indicate the earliest log file required to roll-forward the database after restoring it from the latest backup in case of a crash.

    I guess you can delete log files prior but not including the earliest log file.

  3. #3
    Join Date
    Jan 2004
    Tallahassee, FL, USA
    is that instance not prod , stop the instance , re-start it , take cold backup & stop instance , then delete LOG files.

    if database is non-recoverable , stop the instance , delete log files, if recoverable .

    for safe point of view , take DB backup , then delete logs

    Hope , it may help

    Let me know , if any questions .

    Thank You

    Lekharaju Ennam

  4. #4
    Join Date
    Nov 2002
    You get get the db cfg for that database and list what is the fist active log, look at that number subtract 1 and all the other below that are not needed for the current database to run. Now saying that you can move the other to another dir and BACK THEM UP and delete them. You should change the userexit and then compile it so it will automatically moves them or archives them directly to tape, there are 3 sample user exits, and easy to change.

    db2 get db cfg for xxx |grep -i log will show what is the fist active log

    First active log file = S0037069.LOG

    so in the case, you could move all logs from S0037067.LOG and below safely. Just remember if your doing online backups and need to recover, you'll need the logs listed in the list history command, and if your trying to get to the latest commit point, you'll need any logs created after the backup. So BACKUP everything you'll need before you delete, otherwise you may have problems if you need to restore.
    David Quigley

Posting Permissions

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