使用 onstat 实用程序命令来监视 PDQ 线程

您可以通过运行 onstat -uonstat -g ath 命令来获得有关正在为决策支持查询运行的所有线程的信息。

onstat -u 选项列出了会话的所有线程。如果会话正在运行决策支持查询,那么其输出将列出主线程和任何附加线程。例如:图 1 中的会话 10 共运行着 5 个线程。

图: onstat -u 输出

Userthreads
address  flags    sessid  user     tty     wait     tout locks nreads   nwrites
80eb8c   ---P--D 0        gbasedbt -        0        0    0     33       19
80ef18   ---P--F 0        gbasedbt -        0        0    0     0        0
80f2a4   ---P--B 3        gbasedbt -        0        0    0     0        0
80f630   ---P--D 0        gbasedbt -        0        0    0     0        0
80fd48   ---P--- 45       chrisw   ttyp3    0        0    1     573      237
810460   ------- 10       chrisw   ttyp2    0        0    1     1        0
810b78   ---PR-- 42       chrisw   ttyp3    0        0    1     595      243
810f04   Y------ 10       chrisw   ttyp2    beacf8   0    1     1        0
811290   ---P--- 47       chrisw   ttyp3    0        0    2     585      235
81161c   ---PR-- 46       chrisw   ttyp3    0        0    1     571      239
8119a8   Y------ 10       chrisw   ttyp2    a8a944   0    1     1        0
81244c   ---P--- 43       chrisw   ttyp3    0        0    2     588      230
8127d8   ----R-- 10       chrisw   ttyp2    0        0    1     1        0
812b64   ---P--- 10       chrisw   ttyp2    0        0    1     20       0
812ef0   ---PR-- 44       chrisw   ttyp3    0        0    1     587      227
  15 active, 20 total, 17 maximum concurrent

onstat -g ath 输出还列出了这些线程,并包含指示线程角色的 name 列。由主决策支持线程启动的线程有一个名称,该名称指示它们在决策支持查询中的角色。例如:图 2 列出了四个扫描线程,这些线程是由线程 (sqlexec) 启动的。

图: onstat -g ath 输出

Threads:
tid     tcb     rstcb   prty    status                  vp-class   name
...
11      994060   0        4     sleeping(Forever)         1cpu    kaio
12      994394   80f2a4   2     sleeping(secs: 51)        1cpu    btclean
26      99b11c   80f630   4     ready                     1cpu    onmode_mon
32      a9a294   812b64   2     ready                     1cpu    sqlexec
113     b72a7c   810b78   2     ready                     1cpu    sqlexec
114     b86c8c   81244c   2     cond wait(netnorm)        1cpu    sqlexec
115     b98a7c   812ef0   2     cond wait(netnorm)        1cpu    sqlexec
116     bb4a24   80fd48   2     cond wait(netnorm)        1cpu    sqlexec
117     bc6a24   81161c   2     cond wait(netnorm)        1cpu    sqlexec
118     bd8a24   811290   2     ready                     1cpu    sqlexec
119     beae88   810f04   2     cond wait(await_MC1)      1cpu    scan_1.0
120     a8ab48   8127d8   2     ready                     1cpu    scan_2.0
121     a96850   810460   2     ready                     1cpu    scan_2.1
122     ab6f30   8119a8   2     running                   1cpu    scan_2.2