DB2常用命令1

1.  查看用户连接信息

[db2inst1@testserver ~]$ db2 list applications
 
Auth Id  Application    Appl.      Application Id                                                 DB       # of
         Name           Handle                                                                    Name    Agents
-------- -------------- ---------- -------------------------------------------------------------- -------- -----
SDE      ArcMap.exe     46         192.168.100.210.47006.101228015                                SDE      1
SDE      ArcCatalog.exe 39         192.168.100.210.12702.101228015                                SDE      1
SDE      giomgr         19         *LOCAL
.db2inst1.101228014540                                   SDE      1
SDE      ArcMap.exe     45         192.168.100.210.46238.101228015                                SDE      1
SDE      ArcCatalog.exe 40         192.168.100.210.12958.101228015                                SDE      1
DB2INST1 db2bp          7          *LOCAL
.db2inst1.101228013627                                   SDE      1
SDE      giomgr         20         *LOCAL
.db2inst1.101228014541                                   SDE      1

其中AppHandle和Application Id唯一标识一个应用程序。

2. 使用show detail参数可以显示更详细的信息

[db2inst1@testserver ~]$ db2 list applications show detail
 
CONNECT
 Auth Id           Application Name     Appl.      Application Id                      Seq#  Number of
  Coordinating DB  Coordinator     Status                         Status Change Time
         DB Name  DB Path
                                                                                                                                                      Handle                                                                          Agents     partition number pid/thread
-------------------------------------------------------------------------------------------------------------------------------- -------------------- ---------- -------------------------------------------------------------- ----- ---------- ---------------- --------------- ------------------------------ -------------------------- -------- --------------------
SDE                       ArcMap.exe           46         192.168.100.210.47006.101228015                                00010 1          0                38              UOW Waiting                    Not
 Collected              SDE      /home/db2inst1/db2inst1/NODE0000/SQL00002/
SDE                       ArcCatalog.exe       39         192.168.100.210.12702.101228015                                00016 1          0                37              UOW Waiting                    Not
 Collected              SDE      /home/db2inst1/db2inst1/NODE0000/SQL00002/
SDE                       giomgr               19         *LOCAL
.db2inst1.101228014540                                   00015 1          0                30              UOW Waiting                    Not
 Collected              SDE      /home/db2inst1/db2inst1/NODE0000/SQL00002/
SDE                       ArcMap.exe           45         192.168.100.210.46238.101228015                                00017 1          0                35              UOW Waiting                    Not
 Collected              SDE      /home/db2inst1/db2inst1/NODE0000/SQL00002/
DB2INST1                  db2evmg_DB2DETAILDEA 11         *LOCAL
.DB2.101228013636                                        00001 1          0                31              Connect
 Completed              Not
 Collected              SDE      /home/db2inst1/db2inst1/NODE0000/SQL00002/
DB2INST1                  db2wlmd              10         *LOCAL
.DB2.101228013635                                        00001 1          0                32              Connect
 Completed              Not
 Collected              SDE      /home/db2inst1/db2inst1/NODE0000/SQL00002/
DB2INST1                  db2taskd             9          *LOCAL
.DB2.101228013634                                        00001 1          0                34              Connect
 Completed              Not
 Collected              SDE      /home/db2inst1/db2inst1/NODE0000/SQL00002/
DB2INST1                  db2stmm              8          *LOCAL
.DB2.101228013633                                        00001 1          0                29              Connect
 Completed              Not
 Collected              SDE      /home/db2inst1/db2inst1/NODE0000/SQL00002/
SDE                       ArcCatalog.exe       40         192.168.100.210.12958.101228015                                00025 1          0                36              UOW Waiting                    Not
 Collected              SDE      /home/db2inst1/db2inst1/NODE0000/SQL00002/
DB2INST1                  db2bp                7          *LOCAL
.db2inst1.101228013627                                   00001 1          0                18              Connect
 Completed              Not
 Collected              SDE      /home/db2inst1/db2inst1/NODE0000/SQL00002/
SDE                       giomgr               20         *LOCAL
.db2inst1.101228014541                                   00015 1          0                33              UOW Waiting                    Not
 Collected              SDE      /home/db2inst1/db2inst1/NODE0000/SQL00002/

2. db2pd命令查看数据库中的各种信息

查看数据库的所有组件:

[db2inst1@testserver ~]$ db2pd -edus
 
Database
 Partition 0 -- Active -- Up 0 days 01:26:45
 
List of
 all
 EDUs for
 database
 partition 0
 
db2sysc PID: 7241
db2wdog PID: 7239
db2acd  PID: 7254
 
EDU ID    TID            Kernel TID     EDU Name                               USR          SYS
====================================================================================================
41        2881481616     14913          db2agntdp (SDE     ) 0                 0.050000     0.000000
40        3055545232     12600          db2agntdp (SDE     ) 0                 0.070000     0.050000
39        3056593808     12599          db2agent (instance) 0                  0.020000     0.000000
38        3057642384     11796          db2agent (SDE) 0                       0.000000     0.000000
37        3058690960     11616          db2agent (SDE) 0                       1.710000     0.110000
36        3059739536     9666           db2agent (SDE) 0                       0.060000     0.000000
35        3060788112     9665           db2agent (SDE) 0                       0.340000     0.130000
34        3061836688     7680           db2taskd (SDE) 0                       0.000000     0.000000
33        3062885264     7679           db2agent (SDE) 0                       0.020000     0.000000
32        3063933840     7678           db2wlmd (SDE) 0                        0.000000     0.000000
31        3064982416     7677           db2evmgi (DB2DETAILDEADLOCK) 0         0.000000     0.000000
30        3066030992     7676           db2agent (SDE) 0                       0.400000     0.020000
29        3067079568     7675           db2stmm (SDE) 0                        0.260000     0.190000
28        3068128144     7674           db2pfchr (SDE) 0                       0.000000     0.000000
27        3069176720     7673           db2pfchr (SDE) 0                       0.040000     0.030000
26        3070225296     7672           db2pfchr (SDE) 0                       0.090000     0.040000
25        3071273872     7669           db2pclnr (SDE) 0                       0.000000     0.000000
24        3072322448     7668           db2pclnr (SDE) 0                       0.000000     0.000000
23        3073371024     7667           db2pclnr (SDE) 0                       0.000000     0.000000
22        3074419600     7666           db2dlock (SDE) 0                       0.000000     0.000000
21        3075468176     7665           db2lfr (SDE) 0                         0.000000     0.000000
20        3076516752     7664           db2loggw (SDE) 0                       0.000000     0.000000
19        3077565328     7663           db2loggr (SDE) 0                       0.000000     0.000000
18        3078613904     7637           db2agent (SDE) 0                       0.040000     0.060000
17        3079662480     7252           db2resync 0                            0.000000     0.000000
16        3080711056     7251           db2tcpcm 0                             0.000000     0.000000
15        3081759632     7250           db2tcpcm 0                             0.000000     0.000000
14        3082808208     7249           db2ipccm 0                             0.000000     0.010000
13        3083856784     7248           db2licc 0                              0.000000     0.000000
12        3084905360     7247           db2thcln 0                             0.000000     0.000000
11        3085953936     7246           db2alarm 0                             0.000000     0.000000
1         3054496656     7245           db2sysc 0                              0.080000     0.040000

查看数据库的表空间信息:

[db2inst1@testserver ~]$ db2pd -db sde -tablespaces
 
Database
 Partition 0 -- Database SDE -- Active -- Up 0 days 01:27:36
 
Tablespace Configuration:
Address    Id    Type Content PageSz ExtentSz Auto Prefetch BufID BufIDDisk FSC NumCntrs MaxStripe  LastConsecPg Name
0xAF7465F0 0     DMS  Regular 4096   4        Yes  4        1     1         Off
 1        0          3            SYSCATSPACE
0xAF746DB0 1     SMS  SysTmp  4096   32       Yes  32       1     1         On
  1        0          31           TEMPSPACE1
0xAF74B5B0 2     DMS  Large
   4096   32       Yes  32       1     1         Off
 1        0          31           USERSPACE1
0xAF74BD70 3     DMS  Large
   4096   32       Yes  32       1     1         Off
 1        0          31           REGTBS
0xAF74C530 4     DMS  Large
   4096   32       Yes  64       1     1         Off
 2        0          31           IDXTBS
0xAF74CEE0 5     SMS  UsrTmp  4096   32       Yes  32       1     1         On
  1        0          31           SDESPACE
0xAF74F6C0 6     DMS  Large
   4096   32       Yes  32       1     1         Off
 1        0          31           LOBTBS
0xAF74FE80 7     DMS  Large
   4096   4        Yes  4        1     1         Off
 1        0          3            SYSTOOLSPACE
0xAF750690 8     SMS  UsrTmp  4096   4        Yes  4        1     1         On
  1        0          3            SYSTOOLSTMPSPACE
 
Tablespace Statistics
:
Address    Id    TotalPgs   UsablePgs  UsedPgs    PndFreePgs FreePgs    HWM        State
      MinRecTime NQuiescers
0xAF7465F0 0     24576      24572      19360      0          5212       19360      0x00000000 0          0
0xAF746DB0 1     1          1          1          0          0          0          0x00000000 0          0
0xAF74B5B0 2     40960      40928      33024      0          7904       33024      0x00000000 0          0
0xAF74BD70 3     1048576    1048544    345536     64         702944     345664     0x00000000 0          0
0xAF74C530 4     364544     364480     86272      64         278144     86400      0x00000000 0          0
0xAF74CEE0 5     1          1          1          0          0          0          0x00000000 0          0
0xAF74F6C0 6     1048576    1048544    97888      128        950528     98016      0x00000000 0          0
0xAF74FE80 7     8192       8188       180        0          8008       180        0x00000000 0          0
0xAF750690 8     1          1          1          0          0          0          0x00000000 0          0
 
Tablespace Autoresize Statistics
:
Address    Id    AS
  AR  InitSize    IncSize     IIP MaxSize     LastResize                 LRF
0xAF7465F0 0     Yes Yes 33554432    -1          No
  None
        None
                       No
0xAF746DB0 1     Yes No
  0           0           No
  0           None
                       No
0xAF74B5B0 2     Yes Yes 33554432    -1          No
  None
        None
                       No
0xAF74BD70 3     No
  No
  0           0           No
  0           None
                       No
0xAF74C530 4     No
  No
  0           0           No
  0           None
                       No
0xAF74CEE0 5     No
  No
  0           0           No
  0           None
                       No
0xAF74F6C0 6     No
  No
  0           0           No
  0           None
                       No
0xAF74FE80 7     Yes Yes 33554432    -1          No
  None
        None
                       No
0xAF750690 8     Yes No
  0           0           No
  0           None
                       No
 
Containers:
Address    TspId ContainNum Type    TotalPgs   UseablePgs StripeSet  Container
0xAF746C40 0     0          File
    24576      24572      0          /home/db2inst1/db2inst1/NODE0000/SDE/T0000000/C0000000.CAT
0xAF747400 1     0          Path
    1          1          0          /home/db2inst1/db2inst1/NODE0000/SDE/T0000001/C0000000.TMP
0xAF74BC00 2     0          File
    40960      40928      0          /home/db2inst1/db2inst1/NODE0000/SDE/T0000002/C0000000.LRG
0xAF74C3C0 3     0          File
    1048576    1048544    0          /var/db2data/sde/regtbs
0xAF74CC10 4     0          File
    102400     102368     0          /var/db2data/sde/idxtbs
0xAF74CD68 4     1          File
    262144     262112     0          /var/db2data/sde/idxtbs1
0xAF74D530 5     0          Path
    1          1          0          /var/db2data/sde/sdespace
0xAF74FD10 6     0          File
    1048576    1048544    0          /var/db2data/sde/lobtbs
0xAF750520 7     0          File
    8192       8188       0          /home/db2inst1/db2inst1/NODE0000/SDE/T0000007/C0000000.LRG
0xAF750CE0 8     0          Path
    1          1          0          /home/db2inst1/db2inst1/NODE0000/SDE/T0000008/C0000000.UTM

 

数据库文件的存储位置:

[db2inst1@testserver ~]$ db2pd -db sde -storagepaths
 
Database
 Partition 0 -- Database SDE -- Active -- Up 0 days 01:29:11
 
Database
 Storage Paths:
Number of
 Storage Paths       1
 
Address    PathName
0xAE2B6190 /home/db2inst1

查看数据库中的事务信息:

[db2inst1@testserver ~]$ db2pd -db sde -transactions
 
Database
 Partition 0 -- Database SDE -- Active -- Up 0 days 01:30:17
 
Transactions:
Address    AppHandl [nod-index
] TranHdl    Locks      State
   Tflag      Tflag2     Firstlsn       Lastlsn        LogSpace        SpaceReserved   TID            AxRegCnt   GXID
0xAE5B7A80 19       [000-00019] 2          0          READ
    0x00000000 0x00000000 0x000000000000 0x000000000000 0               0               0x0000001BB407 1          0
0xAE5B8780 11       [000-00011] 3          0          READ
    0x00000000 0x00000000 0x000000000000 0x000000000000 0               0               0x0000001BB2B2 1          0
0xAE5B9480 10       [000-00010] 4          0          READ
    0x00000000 0x00000000 0x000000000000 0x000000000000 0               0               0x0000001BB2AF 1          0
0xAE5BA180 9        [000-00009] 5          0          READ
    0x00000000 0x00000000 0x000000000000 0x000000000000 0               0               0x0000001BB576 1          0
0xAE5BAE80 8        [000-00008] 6          0          READ
    0x00000000 0x00000000 0x000000000000 0x000000000000 0               0               0x0000001BB2AD 1          0
0xAE5BBB80 7        [000-00007] 7          0          READ
    0x00000000 0x00000000 0x000000000000 0x000000000000 0               0               0x0000001BB3CA 1          0
0xAE5BC880 20       [000-00020] 8          0          READ
    0x00000000 0x00000000 0x000000000000 0x000000000000 0               0               0x0000001BB406 1          0
0xAE5BD580 40       [000-00040] 9          0          READ
    0x00000000 0x00000000 0x000000000000 0x000000000000 0               0               0x0000001BB4A5 1          0
0xAE5BE280 39       [000-00039] 10         1          READ
    0x00000000 0x00000000 0x000000000000 0x000000000000 0               0               0x0000001BB4A3 1          0
0xAE5BEF80 45       [000-00045] 11         3          READ
    0x00000000 0x00000000 0x000000000000 0x000000000000 0               0               0x0000001BB48F 1          0
0xAE5BFC80 46       [000-00046] 12         0          READ
    0x00000000 0x00000000 0x000000000000 0x000000000000 0               0               0x0000001BB490 1          0

 

查看数据库的内存池:

[db2inst1@testserver ~]$ db2pd -db sde -bufferpools
 
Database
 Partition 0 -- Database SDE -- Active -- Up 0 days 01:31:38
 
Bufferpools:
First
 Active Pool ID      1
Max
 Bufferpool ID         1
Max
 Bufferpool ID on
 Disk
 1
Num Bufferpools           5
 
Address    Id   Name               PageSz     PA-NumPgs  BA-NumPgs  BlkSize    NumTbsp    PgsToRemov CurrentSz  PostAlter  SuspndTSCt
0xAE893C90 1    IBMDEFAULTBP       4096       1500       0          0          9          0          1500       1500       0
0xAE8930D0 4096 IBMSYSTEMBP4K      4096       16         0          0          0          0          16         16         0
0xAE8933B0 4097 IBMSYSTEMBP8K      8192       16         0          0          0          0          16         16         0
0xAE893690 4098 IBMSYSTEMBP16K     16384      16         0          0          0          0          16         16         0
0xAE893970 4099 IBMSYSTEMBP32K     32768      16         0          0          0          0          16         16         0
 
Bufferpool Statistics
 for
 all
 bufferpools (when
 BUFFERPOOL monitor switch is
 ON
):
 
BPID DatLRds    DatPRds    HitRatio TmpDatLRds TmpDatPRds HitRatio IdxLRds    IdxPRds    HitRatio TmpIdxLRds TmpIdxPRds HitRatio
1    0          0          00.00%   0          0          00.00%   0          0          00.00%   0          0          00.00%
4096 0          0          00.00%   0          0          00.00%   0          0          00.00%   0          0          00.00%
4097 0          0          00.00%   0          0          00.00%   0          0          00.00%   0          0          00.00%
4098 0          0          00.00%   0          0          00.00%   0          0          00.00%   0          0          00.00%
4099 0          0          00.00%   0          0          00.00%   0          0          00.00%   0          0          00.00%
 
BPID DataWrts   IdxWrts    DirRds     DirRdReqs  DirRdTime  DirWrts    DirWrtReqs DirWrtTime
1    0          0          0          0          0          0          0          0
4096 0          0          0          0          0          0          0          0
4097 0          0          0          0          0          0          0          0
4098 0          0          0          0          0          0          0          0
4099 0          0          0          0          0          0          0          0
 
BPID AsDatRds   AsDatRdReq AsIdxRds   AsIdxRdReq AsRdTime   AsDatWrts  AsIdxWrts  AsWrtTime
1    0          0          0          0          0          0          0          0
4096 0          0          0          0          0          0          0          0
4097 0          0          0          0          0          0          0          0
4098 0          0          0          0          0          0          0          0
4099 0          0          0          0          0          0          0          0
 
BPID TotRdTime  TotWrtTime VectIORds  VectIOReq  BlockIORds BlockIOReq FilesClose NoVictAvl  UnRdPFetch
1    0          0          0          0          0          0          0          0          0
4096 0          0          0          0          0          0          0          0          0
4097 0          0          0          0          0          0          0          0          0
4098 0          0          0          0          0          0          0          0          0
4099 0          0          0          0          0          0          0          0          0

查看数据库正在执行的sql信息:

[db2inst1@testserver ~]$ db2pd -db sde -activestatements
 
Database
 Partition 0 -- Database SDE -- Active -- Up 0 days 01:34:38
 
Active Statement
 List:
Address    AppHandl [nod-index
] UOW-ID     StmtID     AnchID StmtUID    EffISO      EffLockTOut EffDegree   EntryTime           StartTime           LastRefTime
0xAFB25B20 39       [000-00039] 16         16         116    1          1           -2          0           Tue Dec
 28 11:11:02 Tue Dec
 28 11:11:02 Tue Dec
 28 11:11:06

查看数据库的日志信息:

[db2inst1@testserver ~]$ db2pd -db sde -logs
 
Database
 Partition 0 -- Database SDE -- Active -- Up 0 days 01:36:32
 
Logs:
Current
 Log Number            0
Pages Written                 0
Method 1 Archive Status       n/a
Method 1 Next
 Log to
 Archive  n/a
Method 1 First
 Failure        n/a
Method 2 Archive Status       n/a
Method 2 Next
 Log to
 Archive  n/a
Method 2 First
 Failure        n/a
 
Address    StartLSN       State
      Size
       Pages      Filename
0xAE302C4C 0x0000CBF88000 0x00000000 1024       1024       S0000000.LOG
0xAE302CEC 0x0000CC388000 0x00000000 1024       1024       S0000001.LOG
0xAE302D8C 0x0000CC788000 0x00000000 1024       1024       S0000002.LOG
0xAE302E2C 0x0000CCB88000 0x00000000 1024       1024       S0000003.LOG
0xAE302ECC 0x0000CCF88000 0x00000000 1024       1024       S0000004.LOG
0xAE302F6C 0x0000CD388000 0x00000000 1024       1024       S0000005.LOG
0xAE30359C 0x0000CD788000 0x00000000 1024       1024       S0000006.LOG
0xAE30363C 0x0000CDB88000 0x00000000 1024       1024       S0000007.LOG
0xAE3036DC 0x0000CDF88000 0x00000000 1024       1024       S0000008.LOG
0xAE30377C 0x0000CE388000 0x00000000 1024       1024       S0000009.LOG
0xAE30381C 0x0000CE788000 0x00000000 1024       1024       S0000010.LOG
0xAE3038BC 0x0000CEB88000 0x00000000 1024       1024       S0000011.LOG
0xAE30395C 0x0000CEF88000 0x00000000 1024       1024       S0000012.LOG

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值