Primary log files are for the use of database and administration notification log are for system administrators. The db2diag log files are for the use of IBM Software Support for troubleshooting.
Even administration notification log messages are also logged to the db2diag log files.
The db2diag tool serves to filter and format the volume of information available in the db2diag log files. Filtering db2diag log file records can reduce the time required to locate the records needed when troubleshooting problems.
Even administration notification log messages are also logged to the db2diag log files.
The db2diag tool serves to filter and format the volume of information available in the db2diag log files. Filtering db2diag log file records can reduce the time required to locate the records needed when troubleshooting problems.
Example 1: Filtering the db2diag log files by database name
If there are multiple databases in the instance we can get a diag log details by the database name using below command.
db2diag -g db=SAMPLE
For more information, issue the following commands:
- db2diag -help provides a short description of all available options
- db2diag -h brief provides descriptions for all options without examples
- db2diag -h notes provides usage notes and restrictions
- db2diag -h examples provides a small set of examples to get started
- db2diag -h tutorial provides examples for all available options
- db2diag -h all provides the most complete list of options
Example 4: Filtering messages from different facilities
The following examples show how to only see messages from a specific facility (or from all of them) from within the database manager. The supported facilities are:
- ALL which returns records from all facilities
- MAIN which returns records from DB2 general diagnostic logs such as the db2diag log files and the administration notification log
- OPTSTATS which returns records related to optimizer statistics
To read messages from the MAIN facility:
db2diag -facility MAIN
To display messages from the OPTSTATS facility and filter out records having a level of Severe:
db2diag -fac OPTSTATS -level Severe
To display messages from all facilities available and filter out records having instance=harmistr and level=Error:
db2diag -fac all -g instance=harmistr,level=Error
To display all messages from the OPTSTATS facility having a level of Error and then outputting the Timestamp and PID field in a specific format:
db2diag -fac optstats -level Error -fmt " Time :%{ts} Pid :%{pid}"
Example 5: Archiving the db2diag log files
You can use the db2diag -archive (or -A) option, to archive the diagnostic log file on an instance-less client.
For example:
0 comments:
Post a Comment