DB2故障诊断-db2diag -rc zrc 和 db2diag -rc ecf

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:1155

诊断日志
当您遇到问题时,可以使用下列设施:
? 首次故障服务日志(其中诊断信息是以可读格式进行合并和存储的)存储在管理通知日志中。
? 两个日志都可在指定路径中找到:
在 UNIX? 系统上,此文件位于 /u/db2/sqllib/db2dump/notifyloglevel.nfy,其中 db2 表示实例名。
在 Windows? 系统上,此文件位于 x:\sqllib\db2\db2diag.log ,其中 x: 表示逻辑驱动器,db2 表示实例名。
? 对于 Windows 操作系统,可以使用“事件查看器”来查看管理通知日志。
? 跟踪实用程序。
? 对于 Linux? 和 UNIX 操作系统,ps 命令将关于活动进程的进程状态信息返回到标准输出中。
? 对于 UNIX 操作系统,核心文件是在发生服务器错误时,在当前目录中创建的。它包含已终止的进程的内存映像,可用来确定哪个功能导致该错误。
[db2inst2@ibmdb2 db2dump]$ ls -lsR
.:
total 6972
756 -rw-rw-rw- 1 db2inst2 db2grp2 768559 Oct 20 07:46 db2diag.log
6156 -rw-r----- 1 db2inst2 db2grp2 6291352 Oct 19 10:56 db2eventlog.000
48 -rw-rw-rw- 1 db2inst2 db2grp2 45195 Oct 20 07:46 db2inst2.nfy
4 -rw-r--r-- 1 db2fenc2 db2grp2 3414 Oct 19 10:15 db2sampl_Import.msg
4 drwxrwxr-t 2 db2inst2 db2grp2 4096 Oct 18 22:51 events
4 drwxrwxr-t 2 db2inst2 db2grp2 4096 Oct 19 01:27 stmmlog
./events:
total 164
164 -rw-rw-rw- 1 db2inst2 db2grp2 163730 Oct 20 07:46 db2optstats.0.log
./stmmlog:
total 4636
4636 -rw-r--r-- 1 db2inst2 db2grp2 4731090 Oct 20 08:02 stmm.0.log

4.1.2 使用db2diag诊断日志

以下命令过滤 2010 年 1 月 1 日之后发生,并且包含分区 0、1 或分区 2
上记录的所有非严重错误和严重错误的所有记录。它会输出匹配的记录,因此时间戳记、分区号和级别将出现在第一行上,而 pid、tid 和实例名将出现在第二行上,之后是错误消息:
如果日志是中文:
db2diag -time 2010-01-01 -node "0,1,2" -level "Severe, Error" |
db2diag -fmt "Time: %{ts}
分区:%node Message Level:%{level} \nPid:%{pid} Tid:%{tid}
实例:%{instance}\nMessage: @{msg}\n"
如果日志是英文:
如我本机现在的情况,操作如下:
db2diag -time 2010-01-01 -node "0,1,2" -level "Error" |
db2diag -fmt "Time: %{ts}
NODE:%node Message Level:%{level}\nPid:%{pid} Tid:%{tid}
INSTANCE: %{instance}\nMessage: @{msg}\n"
输出结果如下:
Time: 2010-10-19-13.10.47.932290
NODE:000 Message Level:Error
Pid:19981 Tid:3066030992
INSTANCE: db2inst2
Message: ADM6019E All pages in buffer pool "IBMDEFAULTBP" (ID "1") are in
use. Refer to the documentation for SQLCODE -1218.

4.1.3 使用db2level查看产品的版本和服务级别

[db2inst2@ibmdb2 db21]$ db2level
DB21085I Instance "db2inst2" uses "32" bits and DB2 code release "SQL09056"
with level identifier "06070107".
Informational tokens are "DB2 v9.5.0.6", "s100918", "IP23208", and Fix Pack
"6a".
Product is installed at "/opt/ibm/db2/V9.5".

4.1.4 使用 db2support 收集环境信息

对 DB2? 问题收集信息时,您需要运行的最重要的 DB2 实用程序是 db2support。

[db2inst2@ibmdb2 db21]$ db2support -h
Syntax: db2support [output path] [Collection Mode:
[-f] [-d [-c]] [-m] [-F]
[-g] [-h] [-l] [-n ]
[-p [-u ]] [-q] [-s]
[-v] [-x] [-o ] [-cfg]
[-timeout ]
[-fodc [ | | list]]
[-st <"sql statment">] [-sf ]
[-se ] [-B]
[-cl ][-td ]
[-cs ][-ro] [-co]
[-cd ]
[-extenddb2batch][-ol ]
[-ra ][-fp ]
[-nc][-nco][-nl][-op ]
[-ot ][-il ]
[Archiving Mode:
[-A [-C [tar|tgz] ] ] ]
Collection Mode:
-c -connect Attempt to connect to specified DB
This is now ON by default if -d is specified
-cfg Collect information related to the current configuration
-d -database Specify the database name and attempt to connect to it
-f -flow Turn off pausing.
-F -full Collect in full mode
-fodc Collect specified FODC directories. Can be specified in
one of the following ways:
1) A comma separated list of the FODC directory names.
2) If no parameter is specified after -fodc a menu with
the available FODC directories to collect will be shown
3) A symptom. All directories corresponding to that symptom
will be collected. It can be one of the following:
Trap, Panic, BadPage, Hang,
IndexError, Perf, DBMarkedBad, AppErr
4) Sub-option 'list' will print a list of FODC directories
on the local host. '-fodc list' is not compatible
with any other options.
-g -get_dump Capture all files in dump directory (excluding core)
-h -help Help on what this tool does (display usage info)
-H -history Collect only data that falls into the specified
history period
-l -logs Capture active logs
-m -html Generate system output in HTML format
-n -number PMR number/identifier for current problem, if known
-nco -noconnect Do not connect to the specified database (Turn off -c)
-o -output Specify the output file name with or without path,
archived in ZIP format. Default output path is the
current directory and default file name is db2support.zip.
Will take precedence if [output path] is also specified.
-p -password Connection password to use with -c
-q -question_resp Interactive problem analysis mode
-s -system_detail Gather detailed hardware and OS info
-t -time Collect only data that falls into the specified time interval
-u -user User ID to use with the -c option
-v -verbose Verbose output while running
-x -xml_generate Produce XML with logic used during -q mode
-timeout Specify the maximum duration of execution
All collections that are remaining when timeout value is
reached will not be collected
Optimizer problem mode options
-B -basic Collect in optimizer basic mode
("db2supp_opt.zip" file only)
-cd -curdegree Specify the current degree special register value
-cl -collect Specify the optimization data collection level
Valid values are:
0 = collect only catalogs, db2look, dbcfg, dbmcfg, db2set
1 = collect 0 plus exfmt
2 = collect 1 plus .db2service (DEFAULT)
3 = collect 2 plus db2batch
(ATTENTION: statement is executed!)
Activate all database partitions using the ACTIVATE command
prior to running db2support with -cl option
-co -complete Collect catalogs for all tables in database
-cs -curschema Specify the current schema value
-extenddb2batch Collect db2batch for all levels specified in -ol. The
optimization data collection level must be 3
-fp -funcpath Specify the function path special register value
-il -isolation Specify the isolation level
-nc -nocatalog Do not collect catalogs
-nl -nodb2look Do not collect db2look data
-ol -optlevel Specify a comma separated list of optimization levels
and collect explain plans for each of them
-op -optprofile Specify the optimization profile special register value
-ot -opttables Specify the current maintained tables for optimization
special register value
-ra -refreshage Specify the refresh age special register value
-ro -reopt Specify EXPLAIN with REOPT ONCE when explaining the query
-se -sqlembed Specify the embedded SQL file path
-sf -sqlfile Specify the SQL file path
-st -sqlstmt Specify the SQL statement
-td -delimiter Specify the statement termination character
Archiving Mode:
-A -archive Move all files in dump directory to the
No db2support.zip file will be generated.
-C -compress Compress the archive directory with all its sub-directories
and files into a .zip file. Must be used with -A only.
tar Compress the archive directory with all its sub-directories
and files into a .tar file. Must be used with -C only. Not
applicable for Windows platform.
tgz Use tar and gzip to archive and compress the archive directory
with all its sub-directories and files into one tar.gz file.
Must be used with -C only. Not applicable for Windows platform.

db2support collection mode will collect(copy) all files into
a compressed file containing either the file name specified by
the user (-o option), or the default file name, db2support.zip.
Any user specified output file names not ending with the ".zip"
extension will have this automatically appended by db2support.
db2support archiving mode will archive(move) all files into a
new directory specified explicitly by the user.
db2support -cfg may only be combined with the following options:
-f, -flow, -c, -connect, -d, -database, -m, -html, -n, -number,
-o, -output, -p, -password, -u, -user, -v and -verbose.

Example of basic invocation:
db2support . -d MyDbName -c
db2support will be in optimizer problem mode when one of the following
options is provided:
db2support -d -st
db2support -d -sf
db2support -d -se
db2support -d -cl 0
Note: -c option is not required for optimizer problem and will be assumed
implicitly. It is also not a requirement anymore for -d option, as it
is now assumed to be turned ON by default when -d is specified. To disable
the attempt for connection use -nco/-noconnect option with -d.
This program generates information about a DB2 server, including
information about its configuration and system environment. The output of
this program will be stored in a file named 'db2support.zip', located
in the directory specified on the application command line. If you are
experiencing problems with DB2, it may help if this program is run
while the problem is occurring.
NOTES:
1. By default, this program will not capture any user data from tables or
logs to protect the security of your data.
2. For best results, run this program using an ID having SYSADM authority.
3. On Windows systems you should run this utility from a db2 command
session.
4. Data collected from this program will be from the machine where this
program runs. In a client-server environment, database-related
information will be from the machine where the database resides via an
instance attachment or connection to the database.

执行 db2support -h 会生成完整的命令选项列表。对于调试问题所需的大多数信息的收集而言,以下基本调用通常已经足够(注意,如果使用 -c 选项,则该实用程序将建立与数据库的连接):
db2support -d -c
输出的收集非常方便,并且会存储在压缩的 ZIP 归档 db2support.zip 中,以便可以很轻松地在任何系统上传送和解压缩。
db2support 捕获的信息类型取决于调用命令的方式、是否启动了数据库管理器以及能否连接至数据库。
db2support 实用程序在所有条件下收集以下信息:
? db2diag.log
? 所有陷阱文件
? 锁定列表文件
? 转储文件
? 各种与系统有关的文件
? 各种系统命令的输出
? db2cli.ini
操作如下:
db2support /soft/db21 -d newdb -c

[db2inst2@ibmdb2 db21]$ db2support /soft/db21 -d newdb -c

_______ D B 2 S u p p o r t ______
This program generates information about a DB2 server, including
information about its configuration and system environment. The output of
this program will be stored in a file named 'db2support.zip', located
in the directory specified on the application command line. If you are
experiencing problems with DB2, it may help if this program is run
while the problem is occurring.
NOTES:
1. By default, this program will not capture any user data from tables or
logs to protect the security of your data.
2. For best results, run this program using an ID having SYSADM authority.
3. On Windows systems you should run this utility from a db2 command
session.
4. Data collected from this program will be from the machine where this
program runs. In a client-server environment, database-related
information will be from the machine where the database resides via an
instance attachment or connection to the database.
Output file is "/soft/db21/db2support.zip"
Time and date of this collection: "Wed 20 Oct 2010 09:23:54 AM CST CST"

Collecting "System files"
"db2eventlog.000"
"db2inst2.nfy"
"db2sampl_Import.msg"
"dasprofile"
"dascshrc"
"db2dasdiag.log"
"SQLOGCTL.LFH.1"
"SQLBP.2"
"SQLOGMIR.LFH"
"SQLDBCONF"
"db2rhist.asc"
"SQLSGF.1"
"SQLOGCTL.LFH.2"
"SQLSPCS.2"
"SQLDBCON"
"SQLSGF.2"
"SQLSPCS.1"
"SQLBP.1"
"db2systm"
"db2cli.ini"
"sqldbbak"
"sqldbins"
"sqldbdir"
"sqlnodir"
"sqlnobak"
"SPM00001.LOG"
"SPM00002.LOG"
"SPM00000.LOG"
"report.log"
Collecting "Basic operating system and hardware information"
Error: Failure reading input at "db2os.C:864". ("/usr/sbin/showmount -e")
Warning: A failure was detected during collection of disk related information.
Error: Failure reading input at "db2os.C:864". ("/usr/bin/lsdev")
Warning: Failed to close a system file with Reason Code "32512". ("/usr/bin/lsdev")
Warning: A failure was detected during collection of hardware related information.
Error: Failure reading input at "db2os.C:864". ("/usr/bin/find /proc/fs -type f -exec /bin/grep -Hv '^$' {} \;")
Warning: A failure was detected during collection of kernel related information.

Collecting "System resource info (disk, CPU, memory)"
Collecting "Operating system and level"
Collecting "JDK Level"
Collecting "JCC version information"
Collecting "JCC configuration information"
Collecting "DB2 Release Info"
Collecting "db2licm -l"
Collecting "db2licm -g"
Collecting "DB2 install path info"
Collecting "Registry info"
Collecting "Registry info"
Collecting "Registry info"
Collecting "EEE node information"
Collecting "Get dbm cfg"
Collecting "db2audit describe"
Collecting "Get admin cfg"
Collecting "List database directory"
Collecting "Sqllib directory listing"
Collecting "Log directory listing"
Collecting "List node directory show detail"
Collecting "List admin node directory show detail"
SQL Code: "-1311"
Collecting "List DCS directory"
Collecting user-specified profile collection
Info: Profile file is not found.
Collecting "General OS Information"
Collecting "Problem Determination Settings"
Collecting "Status of db2trc"
Collecting "Get cli cfg"
Collecting "List DCS applications extended"
Collecting "Query client"
Collecting "List active databases"
Collecting "DB CFG for node 0"
Collecting "Optimizer database configuration"
Collecting "List history since 20100920 for db NEWDB"
Collecting "List applications for database NEWDB global show detail"
...attempting to connect to database: "NEWDB"
Collecting "Detailed DB CFG for node 0"
Error: Internal error "-2029059932" at execution.
Collecting "Buffer pool information"
Collecting "Table space information"
Collecting "Table spaces information through db2pd"
Collecting "List nodegroups show detail"
Collecting "Get snapshot for all applications"
Collecting "Get snapshot for DBM global"
Collecting "Select count(*) from sysibm.systables where type='T' and creator <> 'SYSIBM'"
Collecting "Select max(stringid) from sysibm.sysxmlstrings"
Collecting "Get snapshot for all databases global"
Collecting "List packages for all show details"
Collecting "List tables for all show detail"
Collecting "List indoubt transactions"
SQL Code: "-1462"
Collecting "List DRDA indoubt transactions"
Collecting "List command options"
Collecting "List nodes"
SQL Code: "-1297"
Collecting "List ODBC data sources"

Creating final output archive
"db2support.html"
"db2support_options.in"
"db2support.log"
"db2support.err"
"db2_sqllib_directory.txt"
"db2_log_directory.txt"
"db2supp_system.zip"
"JCC_version.supp_cfg"
"db2trc.info.supp_cfg"
"NEWDB_node0_db.supp_cfg"
"NEWDB_opt_db.supp_cfg"
"dbm.supp_cfg"
"JDKlevel.supp_cfg"
"db2pdcfg.supp_cfg"
"spcs_bp.supp_cfg"
"JCC_config.supp_cfg"
"dbm_detailed.supp_cfg"
"admin.supp_cfg"
"ngrp.supp_cfg"
"cli.supp_cfg"
"db2audit.supp_cfg"
"bp.supp_cfg"
"ODBC_datasources.supp_out"
"admin_nodedir.supp_out"
"db_dir.supp_out"
"db2set.supp_out"
"db2pd.osinfo.supp_out"
"db2level.supp_out"
"db2greg.supp_out"
"list_transactions.supp_out"
"dbsnap.supp_out"
"list_cmd_opts.supp_out"
"db2licm.supp_out"
"list_DRDA_trans.supp_out"
"list_packages.supp_out"
"query_client.supp_out"
"list_apps.supp_out"
"tbspc.supp_out"
"list_tables.supp_out"
"active_db.supp_out"
"dbmsnap.supp_out"
"dcs_dir.supp_out"
"appsnap.supp_out"
"NEWDB_list_hist.supp_out"
"db2pd.tablespaces.supp_out"
"dcsext.supp_out"
"db2licm_report.supp_out"
"list_nodes.supp_out"
"nodedir.supp_out"
"db2diag.log"
"stmm.0.log"
"db2optstats.0.log"

db2support is now complete.
An archive file has been produced: "db2support.zip"
"1" warnings found during the db2support collection
"3" errors found during the db2support collection

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】