Start Your Day With DIAGLOG

db2 diaglog error log tips and tricks
Well to start this DB2DIAG , it’s the place where all the DBA’s look for finding anything wrong or where it went wrong . So all the error’s , warning during the db operations are stored in this places .
Its a DBM CFG parameter and its /instance .
So a single instance will have a single DB2DIAGLOG file .
The default path would be
Diagnostic error capture level (DIAGLEVEL) = 3 
Notify Level (NOTIFYLEVEL) = 3 Diagnostic data directory path (DIAGPATH) = /home/db2inst1/sqllib/db2dump
And we can change it any custom location , if we desire it .
Q? So What is this post about
Ans: Make searching the DIALOGLOG easy for us ,
Q? How do we do that
Ans: DIAGLOG size grows day by day as it accumulates all the messages in db operation , So regularly checking the size of this LOG and archiving it according to the retention policy should really help us .
Well there were some custom cmnd’s where in we can extract the piece of data what we are looking for
db2diag –gi level=severe,db=db-name
Will give us all the severe errors occurred with respect to a particular db-name
db2diag –gi db=db-name
Will give us all levels of error messages with respect to db-name
db2diag –gi db=db-name,level=severe –H 1d
Will give us the previous 1 day logs
So how do we start our day ?
Well for me its always good if i go to office and open my mailbox with DIAGLOG messaged in my inbox and how do we automate that ?
Add a Crontab which mails you error log to your inbox and here how it is
Its scheduled for 12:01AM
01 00 * * * db2diag –gi level=severe,db=dbname | mail –s “Subject of mail” youremail@adress
Well this one directs all the content in the log file and it can be a very large file so 1 day data every day in our inbox is enough and it comes like
01 00 * * * db2diag –gi level=severe,db=dbname –H 1d | mail –s “Subject of mail” youremail@adress

No comments:

Post a Comment