1. 程式人生 > >DB2 體系結構 ----進程模型

DB2 體系結構 ----進程模型

ble result sys 其他 關系 com lis queue sql語句

DB2 是眾多關系型數據庫中的一種, 關系型數據庫還包括比較火的Oracle,MySQL

實例

數據庫

DB2 進程模型

DB2 通過 db2start 命令啟動數據庫實例,即啟動相應的進程和線程,並分配相應內存。

通過命令db2pd -edu 可以查看當前的進程和線程

Database Member 0 -- Active -- Up 62 days 08:14:02 -- Date 2017-11-30-10.05.03.883031

List of all EDUs for database member 0

db2sysc PID: 50397222
db2wdog PID: 7798978
db2acd  PID: 35848426

EDU ID    TID                  Kernel TID           EDU Name                               USR (s)         SYS (s)
========================================================================================================================================
25700     25700                85131497             db2agent (DBNAME) 0                  299.989122    35.183035
25443     25443                15532885             db2agent (instance) 0               1828.692089   150.714185
25186     25186                12452721             db2agntdp (DBNAME  ) 0                 1.461192     0.267469
24929     24929                42795125             db2agntdp (DBNAME  ) 0               805.001309    69.118498
24672     24672                105906353            db2agent (DBNAME) 0                 2396.008347   167.021221
24415     24415                9700293              db2agntdp (DBNAME  ) 0               605.400762    58.211041
23390     23390                28836093             db2agntdp (DBNAME  ) 0               518.864975    45.122775
22365     22365                11207471             db2agntdp (DBNAME  ) 0               924.429698    87.834952
20572     20572                74122051             db2agntdp (DBNAME  ) 0               489.859156    35.603083
20315     20315                55116673             db2agent (DBNAME) 0                 1204.717099    97.264914
19034     19034                87556285             db2shred (DBNAME) 0                  738.600183   193.694051
16216     16216                99287267             db2agent (DBNAME) 0                 1558.502767   103.558734
15447     15447                45286347             db2agent (DBNAME) 0                 1866.006614   114.073616
15190     15190                79495241             db2agntdp (DBNAME  ) 0               897.809516    66.481378
14677     14677                65208411             db2agntdp (DBNAME  ) 0              1052.700318    82.686483
14420     14420                57148199             db2agntdp (DBNAME  ) 0              1688.816066   153.160482
12883     12883                53346535             db2hadrp.0.1 (DBNAME) 0              154.995066   259.085414
12626     12626                65405899             db2pfchr (DBNAME) 0                  102.110779   105.423429
12369     12369                43516805             db2pfchr (DBNAME) 0                  101.542923   105.469408
12112     12112                60818307             db2pfchr (DBNAME) 0                  102.233034   105.734641
11855     11855                22937697             db2pfchr (DBNAME) 0                  166.725686   161.751467
11598     11598                19726521             db2pfchr (DBNAME) 0                  167.057019   161.565368
11341     11341                54722735             db2pfchr (DBNAME) 0                  167.220564   161.810076
11084     11084                19792675             db2pfchr (DBNAME) 0                  373.036013   351.305936
10827     10827                31982535             db2pfchr (DBNAME) 0                  372.714635   351.986265
10570     10570                31917011             db2pfchr (DBNAME) 0                  372.132674   351.735368
10313     10313                80019597             db2pfchr (DBNAME) 0                  637.685985   544.298846
10056     10056                89653343             db2pfchr (DBNAME) 0                  638.920129   543.105383
9799      9799                 23725045             db2pfchr (DBNAME) 0                  638.663849   545.265594
9542      9542                 23461991             db2pfchr (DBNAME) 0                 1914.608769  1268.442838
9285      9285                 17892119             db2pfchr (DBNAME) 0                 1911.178506  1268.271233
9028      9028                 1508307              db2pfchr (DBNAME) 0                 1913.801588  1269.889386
8771      8771                 4850473              db2pfchr (DBNAME) 0                 2577.512813  1551.460310
8514      8514                 69141319             db2pfchr (DBNAME) 0                 2579.779872  1550.337113
8257      8257                 85852397             db2pfchr (DBNAME) 0                 2576.113235  1550.699655
8000      8000                 32243725             db2pclnr (DBNAME) 0                    3.289553     4.452239
7743      7743                 16384245             db2pclnr (DBNAME) 0                    3.362988     4.762008
7486      7486                 55246863             db2pclnr (DBNAME) 0                    3.220689     4.320680
7229      7229                 12976899             db2pclnr (DBNAME) 0                    3.461353     4.877450
6972      6972                 128778295            db2pclnr (DBNAME) 0                    3.741682     5.250532
6715      6715                 19006235             db2pclnr (DBNAME) 0                    3.264976     4.238791
6458      6458                 81133611             db2pclnr (DBNAME) 0                    3.424206     4.716214
6201      6201                 29295565             db2pclnr (DBNAME) 0                    3.486839     4.584265
5944      5944                 97386669             db2pclnr (DBNAME) 0                    4.177199     5.811511
5687      5687                 42729587             db2lfr.0 (DBNAME) 0                   75.019720   115.088266
5430      5430                 68748183             db2loggw (DBNAME) 0                   97.933136   459.297855
5173      5173                 88277109             db2loggr (DBNAME) 0                   68.996509    17.303965
4916      4916                 80543967             db2logmgr (DBNAME) 0                  10.527265    95.248588
4659      4659                 49021949             db2logts (DBNAME) 0                   18.935759     7.338372
4402      4402                 5899207              db2dlock (DBNAME) 0                    2.611647     1.338454
47049     47049                14155891             db2fw11 (DBNAME) 0                  1091.336217   276.876167
45250     45250                11928521             db2fw25 (DBNAME) 0                   700.739470    55.051686
44736     44736                24969295             db2fw32 (DBNAME) 0                   586.312014    51.616603
43451     43451                78905557             db2fw28 (DBNAME) 0                   880.459025    82.502268
44222     44222                125763793            db2agent (DBNAME) 0                 3811.012351   344.231668
43965     43965                25822145             db2fw22 (DBNAME) 0                   811.944363    76.209507
43708     43708                26477321             db2fw3 (DBNAME) 0                     29.793174    14.373388
42937     42937                36634789             db2fw27 (DBNAME) 0                   411.574972    49.799182
43194     43194                20710375             db2fw1 (DBNAME) 0                   3191.766239   268.107187
42680     42680                49873705             db2fw13 (DBNAME) 0                   252.360307    54.068209
42166     42166                52232431             db2fw10 (DBNAME) 0                  1984.438822   193.381039
42423     42423                89587911             db2fw15 (DBNAME) 0                  1344.753677   132.704235
41141     41141                71696563             db2fw7 (DBNAME) 0                   2440.620564   217.004290
40884     40884                78577835             db2fw14 (DBNAME) 0                  1770.320392   180.802365
40627     40627                57934649             db2fw33 (DBNAME) 0                   845.531902    88.320037
40370     40370                11337763             db2fw26 (DBNAME) 0                  2132.334267   181.917716
40113     40113                65209303             db2fw6 (DBNAME) 0                   1745.009377   203.087557
39856     39856                18351011             db2agent (DBNAME) 0                 1981.496332   186.208227
39085     39085                113115321            db2fw30 (DBNAME) 0                   876.991509    94.359239
39599     39599                67174565             db2taskd (DBNAME) 0                  868.639648   102.717013
39342     39342                53805161             db2fw4 (DBNAME) 0                    930.931159    99.678196
38828     38828                23266143             db2agntdp (DBNAME  ) 0              1191.078025   136.260251
38059     38059                14353281             db2fw8 (DBNAME) 0                   2248.994159   225.973022
37802     37802                59048151             db2wlmd (DBNAME) 0                  2163.580966   192.670183
37545     37545                21758897             db2fw17 (DBNAME) 0                  1966.702774   173.434204
37031     37031                124387465            db2fw31 (DBNAME) 0                   871.212481    69.572017
36774     36774                32506767             db2agntdp (DBNAME  ) 0               693.000789    68.179691
36261     36261                131268677            db2agntdp (DBNAME  ) 0              2224.748441   239.658299
34980     34980                126222451            db2fw5 (DBNAME) 0                     48.324498    12.665919
34467     34467                62063519             db2fw2 (DBNAME) 0                   1512.855673   114.011332
31649     31649                5964569              db2agent (DBNAME) 0                 1013.758886   117.206200
28319     28319                125501651            db2lused (DBNAME) 0                  238.550852    45.960126
28062     28062                106430555            db2fw12 (DBNAME) 0                  1486.950147   129.496321
27548     27548                36897697             db2agntdp (DBNAME  ) 0              2464.140995   221.535609
23963     23963                70452143             db2fw34 (DBNAME) 0                     1.826688     1.075234
23706     23706                10093313             db2agent (DBNAME) 0                 1314.294765   111.154238
22937     22937                132055115            db2agntdp (DBNAME  ) 0              1193.804844    91.419791
22680     22680                109576403            db2agent (DBNAME) 0                  190.683874    37.099074
21653     21653                63111963             db2agntdp (DBNAME  ) 0               939.370451    55.506895
21910     21910                18547707             db2fw16 (DBNAME) 0                     0.211371     0.559617
22167     22167                43189013             db2agntdp (DBNAME  ) 0                 9.376437     3.400071
21396     21396                68027363             db2agent (DBNAME) 0                  838.400436    59.675734
21139     21139                11338655             db2agent (DBNAME) 0                 1738.484546   119.898221
20882     20882                10944725             db2agent (DBNAME) 0                  749.498297    52.982475
20113     20113                129958015            db2fw23 (DBNAME) 0                     0.241890     0.557962
19599     19599                16187509             db2agntdp (DBNAME  ) 0               697.772122    51.105313
18573     18573                67896069             db2fw0 (DBNAME) 0                   1013.147295   103.199909
19342     19342                75235385             db2agent (DBNAME) 0                  249.361917    13.767459
17804     17804                33489771             db2agntdp (DBNAME  ) 0               698.754328    62.321696
17290     17290                34668783             db2agent (DBNAME) 0                 1969.385206   155.828127
17033     17033                45940955             db2agntdp (DBNAME  ) 0              1329.968911   118.236051
16776     16776                40305413             db2agntdp (DBNAME  ) 0               854.799861    64.531847
16007     16007                22413405             db2fw20 (DBNAME) 0                     0.187414     0.401443
15750     15750                11666211             db2agent (DBNAME) 0                    6.602363     7.696093
14981     14981                88473661             db2agntdp (DBNAME  ) 0               554.694749    50.801643
14211     14211                37290897             db2agent (DBNAME) 0                 2037.915661   158.137814
13954     13954                47317985             db2fw35 (DBNAME) 0                   182.444188    16.677533
13697     13697                27132137             db2agent (DBNAME) 0                  780.352072    68.575632
13184     13184                83755147             db2fw24 (DBNAME) 0                    81.852439     9.311473
38438     38438                8520563              db2fw18 (DBNAME) 0                     0.337650     0.588922
35852     35852                9896049              db2fw19 (DBNAME) 0                  2154.575689   239.863611
35338     35338                124846123            db2fw9 (DBNAME) 0                    602.489432    91.063575
35081     35081                121045089            db2agent (DBNAME) 0                  482.721274    64.003455
23047     23047                30278605             db2agntdp (DBNAME  ) 0              1131.170239   111.675293
33258     33258                43974849             db2agntdp (DBNAME  ) 0              1289.664496   100.298383
32219     32219                63176935             db2fw29 (DBNAME) 0                   826.314710    91.603506
29393     29393                20316385             db2fw21 (DBNAME) 0                  2158.631234   232.636159
28879     28879                81854637             db2agntdp (DBNAME  ) 0              1438.196953   132.772004
26826     26826                43385701             db2agent (DBNAME) 0                 3402.467914   321.347471
24256     24256                25559867             db2pcsd (DBNAME) 0                  1078.611303   254.106555
18365     18365                87097431             db2agntdp (DBNAME  ) 0              2373.310694   198.576050
18694     18694                52495345             db2stmm (DBNAME) 0                  3272.048318   298.719814
17924     17924                109772929            db2agent (DBNAME) 0                 5564.523573   491.771041
13555     13555                37683363             db2agent (DBNAME) 0                 3898.027706   353.890195
4113      4113                 47579995             db2spmlw 0                             0.000334     0.000595
3856      3856                 38928579             db2spmrsy 0                            0.343302     0.560796
3599      3599                 98631899             db2resync 0                            0.291637     1.686837
3342      3342                 2163465              db2tcpcm 0                           110.812747    72.724551
3085      3085                 131072119            db2tcpcm 0                           110.740027    72.984465
2828      2828                 66388139             db2tcpcm 0                           111.426580    73.525211
2571      2571                 49218535             db2tcpcm 0                           111.180989    73.158306
2314      2314                 42467337             db2tcpcm 0                           111.418349    73.462901
2057      2057                 61145303             db2tcpcm 0                           111.030934    73.149202
1800      1800                 29819829             db2ipccm 0                            10.765461     7.630077
1543      1543                 16974631             db2wlmtm 0                            99.055236    98.481514
1286      1286                 67437551             db2wlmt 0                             71.054473    61.147685
1029      1029                 121176191            db2licc 0                              0.374244     0.152680
772       772                  44565453             db2thcln 0                             0.018871     0.006126
515       515                  31196077             db2auditd 0                            0.000136     0.000009
2         2                    132710447            db2alarm 0                          1006.849255   514.150755
258       258                  113311911            db2sysc 0                            180.197486   251.290303

DB2 主進程

DB2 主進程(DB2 Server Processses)
進程名 進程描述
db2sysc
db2wdog
db2acd

DB2 常用線程

DB2 線程(DB2 Server Threads)
線程名 線程類型 詳細解釋
db2sysc
db2ipccm
db2tcpcm

連接數據庫

DB2 提供了兩種連接方式:

連接方式 常用的命令
1 attach to instance db2 attach to <instance-name> 監控和管理實例 Client application 發送請求給監聽程序,監聽程序為該連接創建agent,並分配 db2agent,client 與agent 建立連接,之後client 發送請求給agent,agent協助處理請求,直到客戶端退出
2 connect to DB db2 connect to <database-name> 執行sql語句 Client application 發送請求給監聽程序,監聽程序為該連接創建agent,並分配 db2agent,創建其他的數據庫subagent來服務client的請求,db2pfchr/db2pclnr db2lfr/db2loggw/db2loggr db2dlock

attach 連接數據庫:

技術分享圖片

connection 連接數據庫:

技術分享圖片

connection 連接數據庫之後執行Query 過程

技術分享圖片

Client sends request to coordinator agent
SQL query compiled or existing access plan retrieved from package cache
Plan execution begins
Parallel subagents dispatched (if intra-query parallelism enabled )
Agent threads access database to update or query data
Results flow from parallel subagents to coordinator agent through table-queues (if intra-query parallelism enabled)
SQL results returned from coordinator agent to client

DB2 體系結構 ----進程模型