Results 1 to 15 of 15
  1. #1
    Join Date
    Sep 2003
    Posts
    84

    db2diag.log housekeeping

    Can anyone tell me how to carry out housekeeping on this file because this can become huge at a point of time.

    Will it suffice to stop the db and delete the file and create an empty file with the same name or do I need to do something different ?

  2. #2
    Join Date
    Nov 2003
    Location
    Netherlands
    Posts
    96

    Re: db2diag.log housekeeping

    Originally posted by Dipanjan
    Can anyone tell me how to carry out housekeeping on this file because this can become huge at a point of time.

    Will it suffice to stop the db and delete the file and create an empty file with the same name or do I need to do something different ?
    You can rename or delete it. DB2 automatically creates a new one if it doesn't exist anymore. If you're lucky you don't need to stop DB2 but I would do it, just to be sure.

    Kind regards, Gert

  3. #3
    Join Date
    Jul 2003
    Location
    Austin, TX, USA
    Posts
    278

    Housekeeping

    Hi,

    Please do stop DB2 as you would not want to lose any informational message/warning/error that could occur within that span of time.

    I would recommend that you take a copy of the file and store it on a different location. Then go ahead and delete the log file. DB2 would create a new file just to be safe you can also create a fresh blank file so that db2 will recognize that and write into that.

    You can follow this process and delete all older copies, I recommend that you keep the latest 2 at the least always so that you can provide IBM with details if ever the situation arises.

    Cheers..

    Nitin.
    HTH

    Nitin

    Ask the experienced rather than the learned

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,426

    Re: Housekeeping

    Originally posted by nitingm
    Hi,

    Please do stop DB2 as you would not want to lose any informational message/warning/error that could occur within that span of time.

    There's no risk in manipulating the log file while the database manager is running.

    What you would probaby do is rename the file. Next time the DBM needs to log something it will re-create it while you can do whatever you want with the renamed copy.

  5. #5
    Join Date
    Nov 2002
    Location
    Delaware
    Posts
    186
    It really depends on if you want to keep it, we have an automated script that renames it once a month. You don't need to recycle db2, If its in the middle of writing something, your rename will wait and if its gone after the rename it will create a new one. We have never lost info beacuse of it. But if you log is getting really large, you should investigate what is causing it and fix it. You may also have your diag level too high.

  6. #6
    Join Date
    May 2003
    Posts
    369

    some tips for db2diag.log files

    Here is what I recommend:

    on a daily basis create compress the db2diag.log file and make archive

    Example: db2diag.log created 1/28/04
    We are using AIX/UNIX so Windows is different

    cp db2diag.log 01282004.log -> to rename the log file
    rm db2diag.log -> don't worry new db2diag.log will be created for new
    entries

    tar -cvf 01282004.log.tar 01282004.log -> create archived file

    compress 01282004.log.tar -> compress it for safe keeping

    mkdir support
    copy and move the logs here for safe keeping

    IBM support also likes this method because I can quickly and easily send via ftp the diag files to their testcase server for analysis. Hope this helps.

    Scott

  7. #7
    Join Date
    Jul 2003
    Location
    Austin, TX, USA
    Posts
    278

    Sample Batch File

    Hi,

    This is a batch file that i wrote in dos.. it copies the file to a new location in a directory datewise. It works great for us. It also creates a new file.

    for /F "tokens=1-4 delims=/- " %%A in ('date/T') do set DATE=%%B%%C%%D
    mkdir C:\%DATE%
    copy "E:\Program Files\IBM\SQLLIB\DB2\db2diag.log" "c:\%DATE%\db2diag.log"
    del "E:\Program Files\IBM\SQLLIB\DB2\db2diag.log"
    echo on > "E:\Program Files\IBM\SQLLIB\DB2\db2diag.log"

    Hope that helps.

    Cheers

    Nitin
    HTH

    Nitin

    Ask the experienced rather than the learned

  8. #8
    Join Date
    Mar 2003
    Posts
    343
    If you decide to create a new file, keep in mind the permissions on the file - they should be 666.

  9. #9
    Join Date
    Jan 2009
    Posts
    153
    HI Experts,

    I tried
    for /F "tokens=1-4 delims=/- " %%A in ('date/T') do set DATE=%%B%%C%%D
    mkdir C:\%DATE%
    copy "E:\Program Files\IBM\SQLLIB\DB2\db2diag.log" "c:\%DATE%\db2diag.log"
    del "E:\Program Files\IBM\SQLLIB\DB2\db2diag.log"
    echo on > "E:\Program Files\IBM\SQLLIB\DB2\db2diag.log"

    this in windows but geting error changes the db2diag.log to db2diag.exe then it copied the file but after deleting am not able to get og files getting error that invalid application db2diag.

    Please help

  10. #10
    Join Date
    Jul 2006
    Location
    Pune , India
    Posts
    433
    you are looking for a solution in a thread that is 5 yrs old ..... strange !!
    look for db2diag documentation for -archive option
    Rahul Singh
    Certified DB2 9 DBA / Application Developer

  11. #11
    Join Date
    Nov 2005
    Location
    IL
    Posts
    557
    Not only that. There is no valid reason for the last 3 lines. mv file new_file is all is needed.
    --
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows

    DB2 v9.7.0.6 os 6.1.0.0

  12. #12
    Join Date
    Jan 2009
    Posts
    153
    i used the archive option only. After doing that thorugh a task i got the error
    getting error that invalid application db2diag.


    I copied the old exe file ..

  13. #13
    Join Date
    Jan 2009
    Location
    Zoetermeer, Holland
    Posts
    746
    No-one uses "db2diag -A"?
    Even better in V9.7 because db2 will log this event in the new db2diag.log file. So you're not left with the situation where you cannot tail the file because it is not there (yet).
    And please do watch the size. On windows2003, when the db2sdiag.log becomes 4Gb: the database freezes...

  14. #14
    Join Date
    Feb 2011
    Posts
    1

    .bin file in db2dump folder

    Hello,

    I have some files in db2dump folder which ends with .bin, I think those were created during crash or els.

    Is it safe to delete those files?

    Thanks

  15. #15
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,361
    It's ok to delete it if you're not going to contact IBM to investigate the crash.

Posting Permissions

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