Results 1 to 6 of 6

Thread: DB2 Log Files

  1. #1
    Join Date
    Jan 2002
    Location
    India
    Posts
    17

    Unanswered: DB2 Log Files

    Hi All,
    I have a doubt about db2 logs.
    When I do a Get DB CFG for dbname , my path to Log files is
    /home1/db2inst1/db2inst1/NODE0000/SQL00003/SQLOGDIR.

    Actually , my home1 filesystem is out of space (99% full) and so I can not run lot of utilities . In LOG dir , there are aroun 350 log files which have been generated since 31dec.(I did a crash recovery on 31st Dec.)

    I am taking online backup daily.
    Do I need to retain log files or else can I remove these files so that I can claim lot of space.?
    The previous crash recovery was done because , some how these log files got deleted from root and mass import was inturrepted. So I am really skeptical about all the log files and their maintenance. How should it be done.

    If I can delete these files what should be the criteria? Does taking offline backup and then deleting these files solves my purpose.????

    Reply ASAP,
    Thanks in advance ,
    Deven.

  2. #2
    Join Date
    Feb 2002
    Posts
    33
    Hi. Retaining all the log files in the log directory isn't necessary. You can see which log files are required based on the logs that were used during the online backup or via the db cfg value (first active log file).

    The first thing would be to get the db cfg, and find the first active log file. All log files before this log number are safe to be archived to a seperate directory (ie/ first active log file = s00000010.log, this means that logs 0-9 are ok to be archived). The reason you should archive log files is that you mentioned daily online backups -- if a restore is needed from an online backup, it will require log file in order for the rollforward phase of the recovery to complete.

    The best thing to do would be to implement a userexit scheme which will automatically archive log files for you.
    Raj

  3. #3
    Join Date
    Jan 2002
    Location
    India
    Posts
    17
    Thanks a lot sir. But the description has creeped in one more doubt in my mind. Actually I have my db cfg as logretain=recovery
    userexit= on


    Could you please focus on these two parameters.?
    What exactly these parameters do and helpful in?
    Does this mean that , I need not keep old log files?

    Thanks in advance,
    Deven.

  4. #4
    Join Date
    Feb 2002
    Posts
    33
    Hi Deven,

    The LOGRETAIN parameter tells us that we will be using archival logging versus circular logging. The advantages of archival logging is that you can perform point in time recovery and tablespace recovery. This is the preferred technique for high use, high visibility production databases (again, more robust in terms of recovery).

    The USEREXIT parameter tells us that you have enabled userexit. Do you recall if yourself or someone else had prepared a userexit program? IBM ships a sample ones ~/sqllib/samples/c directory (seach for "*uext*"). I suggest you review these sample files and check to see if a userexit program has been compiled and made available to the database. This can help maintain your log files automatically by archiving them to a location that you specify within the userexit program.

    In terms of 'keeping' log files. I suggest you first check if userexit is truly archiving log files to a path/filesystem/device. If this is the case, then you should be able to manually clean up log files that have been marked as inactive (refer to the cfg parameter to determine this).

    Lots of ideas here, please let me know if you have further questions.
    Thanks!
    Raj

  5. #5
    Join Date
    Jan 2002
    Location
    India
    Posts
    17
    HI Raj,
    Thanks for the very useful information.
    I guess , all the related issues with the UESREXIT program are very much fine.

    The log file path is
    /home1/db2inst1/db2inst1/NODE0000/SQL00003/SQLOGDIR/.
    The db2uext2 pgm is residing with names like db2uext2.v2 and db2uext2.pe in ~/sqllib/bin dir

    The doubts I have are as follows :

    1. From cfg parameter , how can I get the inactive log file names (or how can I interpret the log file names.)
    The active log shown in cfg command is the latest created one .
    2. Are these db2uext2.v2 and db2uext2.pe names valid for compiled programs for db2uext2.c .

    3. Will changing the logpath parameter to different system , help me ??

    Thanks in advance,
    Deven.

  6. #6
    Join Date
    Feb 2002
    Posts
    33
    Deven,

    Hi.

    For the inactive log files... what I generally do is take the db cfg value for the first active log file, subtract 1, and take all log files below this value to be inactive. For example, db cfg first active log file shows s00004322, subtract 1 and you get 4321, so all log files from 4320 and below are inactive. Reason for the subtraction is to avoid any timing hole where the db cfg didn't get updated as you were checking for first active.

    The next active log tells you the log file that db2 will use when it needs another log.

    I believe that the compiled userexit needs to have a filename called 'db2uext'. This should be detailed in Admin guide under Using Userexit.

    As for changing the logpath to a different system. I've never actually tried this as I have always had access to an ADSM server. However, I believe that it is possible to FTP logfiles across systems.

    Raj

Posting Permissions

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