文档章节

db2top - DB2 monitoring tool command

Goopand
 Goopand
发布于 2015/04/15 16:32
字数 2882
阅读 36
收藏 0



db2top - DB2 monitoring tool command

The db2top command provides a unified, single-system view of a multi-partition database or single-partition database on the AIX®, Linux, HP-UX, and Solaris operating systems. Quickly identifies global problems, or specific database partition problems in the system. By combining snapshot information from each database partition, a dynamic real-time view of a running DB2® system is provided.

Scope

db2top can be run in interactive mode or in batch mode.

Authorization

One of the following:

  • sysadm

  • sysctrl

  • sysmaint

  • sysmon

Required connection

Instance. A connection is not required in replay or client mode.

Command syntax

>>-db2top--+- -A----------------------------+------------------><
           +- -a----------------------------+   
           +- -B----------------------------+   
           +- -b -suboption-----------------+   
           +- -C--suboption-----------------+   
           +- -D--delimiter-----------------+   
           +- -d--database name-------------+   
           +- -f--file </HH:MM:SS><+offset>-+   
           +- -h----------------------------+   
           +- -i--interval in seconds-------+   
           +- -k----------------------------+   
           +- -L----------------------------+   
           +- -m--duration in minutes-------+   
           +- -n--node name-----------------+   
           +- -o--outfile-------------------+   
           +- -P--dbpartition number--------+   
           +- -p--password------------------+   
           +- -R----------------------------+   
           +- -s--number--------------------+   
           +- -u--username------------------+   
           +- -V--schema--------------------+   
           '- -x----------------------------'

Command parameters

  • -A

    Enables automatic performance analysis. The db2top command produces a top five performance report. Use this option in replay and background mode (-b parameter). Typical usage includes:

    Running db2top in collection mode for a long period (for example, 4 hours):

    db2top -f collect.file -C -m 240

    Running db2top in replay mode with automatic performance analysis. Automatic performance analysis is available for any functions supported in background mode and is based on the default sort criteria specified in the .db2toprc configuration file for the selected suboption (automatic performance analysis is also available in background mode, even when not replaying). As an example, to analyze the most active sessions, issue the following command:

    db2top -f collect.file -b l -A

    Running db2top in replay mode, jumping to the desired point in time to analyze further:

    db2top -f collect.file /HH:MM:SS
  • -a

    Specifies that only active objects are displayed.

  • -B

    Displays active objects in bold (reverse) color. This is helpful when the screen does not support colors and colors are set to off in the .db2toprc configuration file.

  • -b suboption

    Runs db2top in background mode. When using the -b parameter, the db2top command displays information in CSV format. db2top can be run in background mode in combination with reading snapshot data from a collection file using the -f file parameter. Issuing multiple sub-options for background mode (-b) is not supported. The -b parameter takes one of the following sub-option values:

    The following parameters can only be used with the -b parameter: -X-L-A-s-D-o.

    • d

      database

    • l

      sessions

    • t

      tablespaces

    • b

      bufferpools

    • T

      tables

    • D

      Dynamic SQL

    • s

      Statements

    • U

      Locks

    • u

      Utilities

    • F

      Federation

    • m

      Memory pools

  • -C

    Runs db2top in snapshot collector mode. Raw snapshot data is saved in <db2snap-<dbname>-<Machine><bits><.bin> by default (unless -f is specified). Pipe can also be specified for output instead of file. Specifying multiple sub-options for collector mode (-C) are supported. To include locks information in the collection file, use -x along with -C. The -C parameter takes one of the following sub-option values:

    The db2top command runs in replay mode if the -C command parameter is not specified.

    • b : buffer pools

    • D : Dynamic SQL

    • d : database

    • F : Federation

    • l : sessions

    • s : Statements

    • T : Tables

    • t : tablespaces

    • U : Locks

  • -D delimiter

    Specifies the field delimiter (single character). Use in background mode (-b parameter).

  • -d database name

    Specifies the database to monitor.

  • -f file </HH:MM:SS><+offset>

    • If the -f parameter is not specified, db2top is run in replay mode. If the -f parameter is specified, it indicates output filename. The database name specified with the -d parameter does not need to exist. It is only referenced if you want to issue explains or Dump DB Struct.

      In replay mode (-C parameter is not used), if snapshot data has been previously collected in file, offset jumps to a certain point in time in the file. It can be expressed in seconds (+10s), minutes (+10m) or hours (+10h). /HH:MM:SS skips entries until the specified point in time.

    • In the collector mode (-C parameter is used), you can specify the output filename. </HH:MM:SS><+offset> will be ignored if you are in collector mode

  • -h

    Displays usage information for the db2top command.

  • -i interval in seconds

    Specifies the delay between screen updates. The delay time cannot be less than one second.

  • -k

    Displays actual or delta values. For all functions in delta mode, delta values are computed and displayed on a per second basis regardless of the specified refresh interval.

  • -L

    Specifies that statements that are currently executing or most recent statements from current sessions are captured at each reporting interval specified by the -i parameter. If an SQL statement starts and finishes between an interval, it will not be included.

    In the background mode, use -b l -L parameters to catch SQL statements executed in a session and output them to the ALL.sql file in the current working directory.

    Currently executing or the most recent SQL statement for a connected session are captured at each interval (as specified by -iparameter). If a SQL statement starts and finishes between an interval, it will not be caught.

  • -m duration in minutes

    Limits the duration of db2top in minutes for -b and -C parameters.

  • -n node name

    Specifies the node to attach to.

  • -o

    Specifies the output file name. Used in background mode (-b parameter).

  • -P dbpartition number

    Specifies the database partition number on which the snapshot will be issued. If the -P parameter is specified and the dbpartition number is not specified, db2top attaches to the default database partition.

  • -p

    Specifies the password used to access the database. If omitted and the -u parameter has been specified, the user is prompted for the password

  • -R

    Resets snapshot at startup.

  • -s number

    Specifies how many samples will be displayed. Only supported in background mode (-b parameter).

  • -u

    Specifies the username used to access the database.

  • -V schema

    Specifies the default schema used in explains.

  • -x

    Specifies whether to display additional counters on session and application screens (might run slower on session).

  • -X

    Specifies format of output is XML. Use in background mode in conjunction with the -b parameter.



Snapshot data collector

The db2top monitoring utility can be run in replay mode, which means it can run against a saved copy of the raw binary snapshot data. To run in replay mode, db2top must be first run in data collector mode, either in batch mode by running db2top from the command line with the-C parameter, or by activating or deactivating data collection from an interactive session by pressing C. This will create a file <db2snap-hostname.bin> in the current directory. Then, the db2top utility can be run against <db2snap-<dbname>-<Machine><bits>.bin>using the -f arguments. The db2top monitoring utility does not need to attach to the DB2 instance in replay mode, which is convenient for remote monitoring. It is possible to limit the content and size of the stream file by specifying any of the sub-options available to the -Cparameter.

Examples (batch mode)

The command parameters are as below:
-b l          --> Run in background mode, while catching the "sessions" related 
                  info in db2top
-C            --> run db2top in snapshot collector mode 
-d CUST       --> database
-i 3          --> 3 second interval
-m 60         --> limit duration of db2top to 60 minutes
-n node       --> node 
-o db2top.xml --> output file db2top.xml
-p password   --> password
-s 10000      --> collect 10000 samples
-u userid     --> userid
-V sv9        --> Schema 
-x            --> display additional counters on session

The following example commands monitor a database called "CUST" on a node called "node" with a schema called "sv9". The user ID for the database is "userid", and the password is "password":

  • The following example command, monitors the database in background mode in three second intervals for sixty minutes and outputs session information in XML format into a file called db2top.xml:

    db2top -d CUST -n node -u userid -p password -V sv9 -i 3 -b l -X -o db2top.xml -m 60
  • The following example command, monitors the database in background and snapshot collection mode, collecting 10000 samples of session information in XML format. The output binary file is db2snap-CUST-AIX64.bin:

    db2top -d CUST -n node -u userid -p password -V sv9 -b l -x -s 10000 -X -f db2snap-CUST-AIX64.bin
  • The following example command replays the output capture in the previous example command:

    db2top -d CUST -f db2snap-CUST-AIX64.bin

For more information, refer to the DB2 problem determination using db2top utility athttp://www.ibm.com/developerworks/data/library/techarticle/dm-0812wang/

Related tasks:
Monitoring with db2top in interactive mode commandsRelated reference:
.db2toprc configuration file


以上是官方使用说明:

http://www.ibm.com/support/knowledgecenter/SSEPGG_9.7.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0025222.html





中文使用说明


db2top 监视实用程序快速高效地监视复杂的 DB2® 环境。它结合来自所有数据库分区的 DB2 快照信息,使用基于文本的用户界面提供正在运行的 DB2 系统的动态实时视图。

以交互方式运行 db2top 时,您可以发出下列命令:

  • A

    监视 HADR 集群中的主数据库或辅助数据库。

  • a

    转至代理程序的应用程序详细信息(或在声明屏幕上限制代理程序)。db2top 命令将提示您输入代理程序标识。

  • B

    显示关键服务器资源的主要使用者(瓶颈分析)。

  • c

    此选项允许您更改屏幕上显示的列的顺序。语法采用下列格式:1,2,3,...,其中 1,2,3 分别对应于所显示的第 1 列、第 2 列和第 3 列。这些是指定排序条件时要使用的列数。

    当使用 c 交换关键字时,将显示屏幕,指定屏幕上显示的列的顺序。屏幕的左侧部分显示缺省顺序和列数;屏幕右侧部分显示当前排序。要更改列的顺序,在屏幕底部文本字段中输入新的列顺序。接着,如左侧显示的那样,输入相对的列位置,用逗号对其分隔。不需要指定所有列。对于后续的 db2top 监视会话,可以通过选择 w 将此列排序保存在 $DB2TOPRC 中。您可以进行排序,并选择采用哪种顺序在屏幕上显示列。.db2toprc 文件中列排序的有效关键字是:

    • sessions=

    • tables=

    • tablespaces=

    • bufferpools=

    • dynsql=

    • statements=

    • locks=

    • utilities=

    • federation=

  • b

    转至缓冲池屏幕。

  • C

    打开或关闭快照数据收集器。

  • d

    转至数据库屏幕。

  • D

    转至动态 SQL 屏幕。

  • f

    冻结屏幕。

  • F

    在主服务器上监视联合查询。

  • G

    打开或关闭图表。

  • h

    转至帮助屏幕

  • H

    转至历史记录屏幕

  • i

    打开或关闭闲置会话。

  • k

    切换实际值与增量值。

  • l

    转至会话屏幕。

  • L

    允许显示来自 SQL 屏幕的完整查询文本。然后,可以使用 e 或 X 选项来运行常规 DB2 说明。

  • m

    显示内存池。

  • o

    显示会话设置。

  • p

    转至分区屏幕。

  • P

    选择要发出快照的数据库分区。

  • q

    退出 db2top

  • R

    重置快照数据。

  • s

    转至语句屏幕。

  • S

    运行本机 DB2 快照。

  • t

    转至表空间屏幕。

  • T

    转至表屏幕

  • u

    显示活动的实用程序,并且跨数据库分区将它们聚集起来。

  • U

    转至锁定屏幕。

  • V

    设置缺省说明模式。

  • w

    将会话设置写至 .db2toprc。

  • W

    agent_id、os_user、db_user、应用程序或网络名的观看方式。会话快照(选项 l)返回的语句将写至 agent.sql、 os_user-agent.sql、db_user-agent.sql、application- agent.sql 或 netname-agent.sql。 当从动态 SQL 屏幕(选项 D)发出时,语句将采用与 db2advis 兼容的格式写至 db2adv.sql。

  • X

    打开或关闭扩展方式。

  • z|Z

    按升序或降序方式进行排序。

  • /

    将表达式输入至过滤器数据。表达式必须符合正则表达式。您可以采用不同方法过滤每个函数(屏幕)。可对整行应用 regexp 检查。

  • <|>

    移至屏幕的左侧或右侧。



下列切换只适用于应用程序屏幕:

  • r

    返回至上一函数。

  • R

    切换自动刷新。

  • g

    打开或关闭图表。

  • X

    打开或关闭扩展方式。

  • d

    显示代理程序。

要以交互方式启动 db2top,可发出下列命令:

db2top -d <database name>

当输入

db2top -d sample

时,将显示下列输出:

[\]11:57:10,refresh=2secs(0.000) Inactive,part=[1/1],<instanceName>:sample
[d=Y,a=N,e=N,p=ALL] [qp=off]

[/]:当旋转时,它表示 db2top 在两个快照之间等待,否则,它表示 db2top 在等待 DB2 的答复
11:57:10:当前时间
refresh=2secs:时间间隔
refresh=!secs:感叹号表示 DB2 处理快照所需的时间超过时间间隔。在此情况下,db2top 将按
50% 增加时间间隔。如果由于系统太忙而频繁发生此问题,那么您可以增加快照时间间隔
(选项 I)、监视单一数据库分区(选项 P)或关闭扩展显示方式(选项 x)
0.000:DB2 内部处理快照所花费的时间
d=Y/N:增量或累积快照指示器(命令选项 -k 或选项 k)。
a=Y/N:仅限于活动对象指示器的或所有对象指示器(-a 命令选项集或 i)
e=Y/N:扩展显示指示器
p=ALL:所有数据库分区
p=CUR:当前数据库分区(-P 命令选项,未指定分区数)
p=3:目标数据库分区数:例如,3

Inactive:如果 DB2 没有在运行,那么会显示不活动,否则会显示运行 DB2 的平台
part=[1/1]:活动数据库分区数与总计数据库分区数。例如,part=[2,3] 表示总共有 3 个
数据库分区,其中有一个数据库分区停机(2 个数据库分区处于活动状态,共有 3 个)
<instanceName>:实例名
sample:数据库名称
qp=off/on:已连接 db2top 的数据库分区的 Query Patroller 指示器(DYNMGMT 数据库
配置参数)

下列示例演示在分区数据库环境中以交互方式运行 db2top 监视实用程序:

db2top -d TEST -n mynode -u user -p passwd -V skm4 -B -i 1
命令参数如下所示:
-d TEST     # 数据库名称
-n mynode   #  节点名
-u user     #  用户标识
-p passwd   #  密码
-V skm4     #  模式名称
-B          #  启用粗体
-i 1        #  屏幕更新时间间隔:1 秒


中文使用说明 转自:

http://blog.csdn.net/xiyuan1999/article/details/8443843


本文转载自:http://www-01.ibm.com/support/knowledgecenter/SSEPGG_9.7.0/com.ibm.db2.luw.admin.cmd.doc/doc/r002...

共有 人打赏支持
Goopand
粉丝 9
博文 416
码字总数 203178
作品 0
朝阳
私信 提问
18 Command Line Tools to Monitor Linux Performance

It’s really very tough job for every System or Network administrator to monitor and debug Linux System Performance problems every day. After being a Linux Administrator for 5 y......

wuyaoito
2014/02/18
0
0
DB2top工具-查看完整sql

db2综合监控工具db2top, 其动态sql视图部分在sql一列只显示前30个字符串, 如何查看完整的sql呢? 如下方法: 按下Shift+L, 提示输入hash string, 即最左边的一列HashValue值, 粘贴上去回车就可...

月下沙加
2012/11/06
0
0
DB2 表空间监控

默认DB2 缓冲池信息监控是OFF, 需要开启(DB2表空间是由缓冲池分配的) CollBufferpool : ============ The CollBufferpool collector collects information for the DB2UDB_BUFFERPOOL appl......

xujh1986
2016/02/25
0
0
Install Htop 2.0 – Linux Process Monitoring for RHEL, CentOS & Fedora

原文:https://www.tecmint.com/install-htop-linux-process-monitoring-for-rhel-centos-fedora/ This article is the continuation of our Linux system monitoring series, today we’re ......

zdhsoft
03/27
0
0
20 Linux System Monitoring Tools Every SysAdmin Should Know

Need to monitor Linux server performance? Try these built-in commands and a few add-on tools. Most Linux distributions are equipped with tons of monitoring. These tools provide ......

wuyaoito
2014/02/19
0
0

没有更多内容

加载失败,请刷新页面

加载更多

jquery通过id显示隐藏

var $div3 = $('#div3'); 显示 $div3.show(); 隐藏 $div3.hide();

yan_liu
今天
3
0
《乱世佳人》读书笔记及相关感悟3900字

《乱世佳人》读书笔记及相关感悟3900字: 之前一直听「荔枝」,后来不知怎的转向了「喜马拉雅」,一听就是三年。上班的时候听房产,买房了以后听装修,兴之所至时听旅行,分手后听亲密关系,...

原创小博客
今天
3
0
大数据教程(9.6)map端join实现

上一篇文章讲了mapreduce配合实现join,本节博主将讲述在map端的join实现; 一、需求 实现两个“表”的join操作,其中一个表数据量小,一个表很大,这种场景在实际中非常常见,比如“订单日志...

em_aaron
今天
3
0
cookie与session详解

session与cookie是什么? session与cookie属于一种会话控制技术.常用在身份识别,登录验证,数据传输等.举个例子,就像我们去超市买东西结账的时候,我们要拿出我们的会员卡才会获取优惠.这时...

士兵7
今天
3
0
十万个为什么之为什么大家都说dubbo

Dubbo是什么? 使用背景 dubbo为什么这么流行, 为什么大家都这么喜欢用dubbo; 通过了解分布式开发了解到, 为适应访问量暴增,业务拆分后, 子应用部署在多台服务器上,而多台服务器通过可以通过d...

尾生
今天
4
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部