If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > db2diag.log housekeeping

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
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 ?
Reply With Quote
  #2 (permalink)  
Old
Registered User
 
Join Date: Nov 2003
Location: Netherlands
Posts: 96
Re: db2diag.log housekeeping

Quote:
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
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 5,333
Re: Housekeeping

Quote:
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.
Reply With Quote
  #5 (permalink)  
Old
Registered User
 
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.
Reply With Quote
  #6 (permalink)  
Old
Registered User
 
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
Reply With Quote
  #7 (permalink)  
Old
Registered User
 
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
Reply With Quote
  #8 (permalink)  
Old
Registered User
 
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.
Reply With Quote
  #9 (permalink)  
Old
Registered User
 
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
Reply With Quote
  #10 (permalink)  
Old
Registered User
 
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
Reply With Quote
  #11 (permalink)  
Old
Registered User
 
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
Reply With Quote
  #12 (permalink)  
Old
Registered User
 
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 ..
Reply With Quote
  #13 (permalink)  
Old
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 731
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...
Reply With Quote
  #14 (permalink)  
Old
Registered User
 
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
Reply With Quote
  #15 (permalink)  
Old
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 2,357
It's ok to delete it if you're not going to contact IBM to investigate the crash.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On