Results 1 to 9 of 9
  1. #1
    Join Date
    Apr 2003
    Posts
    23

    Question Unanswered: How do I get rid of all these log files (online backup enabled)

    Hi everybody,

    I'm getting a huge number of log files in the log directory, it's up to about 600 files. What can I do to get rid of these? I thought that when I ran an online backup, that it would get rid of these?

    Is there something else I need to be doing after the online backup?

  2. #2
    Join Date
    Apr 2003
    Posts
    191

    Re: How do I get rid of all these log files (online backup enabled)

    Hi,

    no, online backup doesn't do away with archive logs.

    Could you please pass the output of:

    db2 get db cfg for ...

    Johann

    Originally posted by iceman
    Hi everybody,

    I'm getting a huge number of log files in the log directory, it's up to about 600 files. What can I do to get rid of these? I thought that when I ran an online backup, that it would get rid of these?

    Is there something else I need to be doing after the online backup?

  3. #3
    Join Date
    Mar 2003
    Posts
    343
    You have logretain set to recovery but have not turned the userexit on. IBM provides sample userexits under $insthome/sqllib/samples/c and this functionality may be activated as follows.

    db2uext2.cadsm <<-->> Archive to TSM
    db2uext2.cdisk <<-->> Archive to disk
    db2uext2.ctape <<-->> Unix Tape archive
    db2uext2.cxbsa <<-->> Archive to Legato Networker(AIX)
    Depending on the method of archiving, copy the required file to db2uext2.c

    Edit db2uext2.c to customize
    AUDIT_ERROR_PATH
    ARCHIVE_PATH
    RETRIEVE_PATH
    and create these directories.

    Compile and link db2uext2.c to db2uext2.exe and copy this file to $insthome/sqllib/bin/

    Activate it by updating the db cfg parameter USEREXIT to ON

    This will archive the logs to another directory and you could create a job to clean up this directory based on the retention period of the online backups.

    A word of caution about deleting log files when you are doing online backups - if you do not have the log files related to the online backup(ie when the backup was running) you may not be able to recover from this backup. After recovering,. the database will remain in rollforward pending. A good practice is to truncate the logs before the backup and truncate again right after the backup(if you have the registry variable DB2_DISABLE_FLUSH_LOG set ot ON). If the registry variable is not set or set to off, then db2 will truncate the logs after completing the backups. These logs are required to recover from the online backup. This needs to be addressed if you are considering deleting old logs.

    Hope this helps.

  4. #4
    Join Date
    May 2003
    Posts
    369

    Re: How do I get rid of all these log files (online backup enabled)

    We had the same problem with DB2 using online backups. I recommend at least until you get userexit setup (this takes time and work)

    1. db2 get db cfg for your_database
    2. find the first/last active logfile
    3. backup old logs to TSM or another storage device to be safe
    3. use the db2 prune logfile command to delete old logs

    I recommend that you keep the first/last active logs and the 10 logs before it just to play things safe. Good luck.

    Scott

  5. #5
    Join Date
    Mar 2003
    Location
    Singapore
    Posts
    200
    Hi,

    How is your backup strategy,do u take any offline backups.

    If u have a offline backup,u can actually delete the all log files before that,provided u r sure u don't need to restored to a date before this backup.

    To be safe as another member said u can Zip and remove then to a different location.

    U can also get rid of the log files by turning off the logretain.

    If u cannot manage to take an offline backup it is always save to archive all the log files prior to the first active log.This can be found from the DB CFG parameters.

    Try this out.

    mickykt

  6. #6
    Join Date
    Apr 2003
    Posts
    23

    Thumbs up

    Wow, the responses this question have been really good.

    Here's what's in our db config:

    First active log file = S0000713.LOG
    Log retain for recovery enabled (LOGRETAIN) = RECOVERY
    User exit for logging enabled (USEREXIT) = ON


    So USEREXIT is enabled but looking in the db2diag.log file, somehow it cannot find the USEREXIT program. I'm going to look into enabling that or manually copying the logs to an archive location.

    I let everyone know how it goes.

    Thanks again for the very helpful information.

  7. #7
    Join Date
    Apr 2003
    Posts
    23
    Wow, USEREXIT has alot of different things going on. I'm still trying to digest it all:

    http://www7b.boulder.ibm.com/dmdd/li...0307kline.html

  8. #8
    Join Date
    Mar 2003
    Posts
    343
    The userexit needs to be edited, copied to db2uext2.c, compiled and linked and then copied into $insthome/sqllib/bin/. Only then will db2 locate it. Thanks for the link.

  9. #9
    Join Date
    Mar 2003
    Posts
    343
    FYI, the restore utility uses the userexit - if it's not inplace and the occassion does arise, it must be put in place, as above, to recover the database.

Posting Permissions

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