数据库运维
记录DBA学习成长历程

第13章:GBase 8s 管理员常用命令

文章目录

1 oninit

—1.1 启动数据库到在线模式

启动GBase 8s。通过这个命令启动后,GBase 8s进入在线服务状态,可以对外提供联机服务。

oninit -vy

参数
v:启动过程中,输出详细信息。
y:使用非交互方式,即如果有需要选择的,全部按y处理。

[gbasedbt@devsvr ~]$ onstat -
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 16:23:56 -- 597864 Kbytes

[gbasedbt@devsvr ~]$ 

—1.2 启动数据库到单用户模式

当管理员希望只有自己或其它管理员可以连接到数据库,进行一些维护工作时,可以使用下面的命令,将数据库启动到单用户模式。

oninit -j
[gbasedbt@devsvr ~]$ onstat -
Your evaluation license will expire on 2022-06-18 00:00:00
Single-User -- Up 2 days 16:21:38 -- 597864 Kbytes

[gbasedbt@devsvr ~]$ 

—1.3 启动数据库到静态模式

当管理员希望做一些非SQL类的维护操作时,可以将数据库启动到静态模式。在这个模式下,只允许进行一个命令行的运维操作,不允许进行SQL操作。

当进行数据库恢复操作后,数据库通常在恢复完成后,进入静态模式。管理员可以运行onmode -m命令,将数据库切换到在线模式。

oninit -s
[gbasedbt@devsvr ~]$ onstat -
Your evaluation license will expire on 2022-06-18 00:00:00
Quiescent -- Up 2 days 16:19:42 -- 597864 Kbytes

[gbasedbt@devsvr ~]$ 

2 onmode

—2.1 切换数据库到在线模式

当数据库处于单用户模式或静态模式时,可以通过这个命令,将数据库切换到在线模式,并对外提供数据库服务。

onmode -m

—2.2 切换数据库到离线模式

使用下面的命令,可以关闭数据库。当数据库出现意外情况(如rootdbs被意外删除),需要进行冷恢复时,需要先将数据库关闭。

onmode -k

—2.3 切换数据库到静态模式

当管理员在维护时,不希望有任何的SQL连接,对数据库进行操作,可以将数据库切换到静态模式。

onmode -s
onmode -u

参数
s:优雅地切换到静态模式。当有用户连接到数据库时,会等用户断开连接后再进行模式切换。
u:立即切换到静态模式。当有用户连接到数据库时,会直接杀掉用户连接,并进行模式切换。

—2.4 切换数据库到单用户模式

切换到单用户模式,只允许管理员进行操作,不允许普通用户连接数据库。

onmode -j

—2.5 切换逻辑日志文件

强制数据库做一次逻辑日志切换。切换后,新的逻辑日志将写入到下一个逻辑日志文件中。

onmode -l

当前的逻辑日志被标记为C,将逻辑日志切换到下一个后,当前的逻辑日志有11变为12。

[gbasedbt@devsvr ~]$ onstat -l
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 00:31:26 -- 597864 Kbytes

Physical Logging
......
4843bb78         10       U-B----  1033     2:30053              5000     5000   100.00
4843bbe0         11       U---C-L  1034     2:35053              5000      176     3.52
4843bc48         12       U-B----  1015     2:40053              5000     5000   100.00
......
46febf30         23       U-B----  1026     2:95053              5000     5000   100.00
 20 active, 20 total

[gbasedbt@devsvr ~]$ onmode -l
Your evaluation license will expire on 2022-06-18 00:00:00
[gbasedbt@devsvr ~]$ onstat -l
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 00:31:38 -- 597864 Kbytes

Physical Logging
......
4843bbe0         11       U-----L  1034     2:35053              5000      177     3.54
4843bc48         12       U---C--  1035     2:40053              5000        0     0.00
4843bcb0         13       U-B----  1016     2:45053              5000     5000   100.00
......
46febf30         23       U-B----  1026     2:95053              5000     5000   100.00
 20 active, 20 total

[gbasedbt@devsvr ~]$ 

—2.6 强制执行检查点

执行检查点,会将缓冲区中的“脏”块,写入数据文件。

onmode -c
onmode -c unblock
onmode -c block <seconds>

强制执行检查点操作时,可以选择阻塞或不阻塞事务。

—2.7 设置共享内存的常驻部分的强制驻留

开始共享内存的常驻部分的强制驻留

[gbasedbt@devsvr ~]$ onmode -r
Your evaluation license will expire on 2022-06-18 00:00:00

This will set the shared memory buffer cache to RESIDENT -
Do you wish to continue (y/n)? y
Note that this command will be phased out in a future release. Please use
the OpenAdmin Tool (OAT) or onmode -w[mf] for dynamic configuration tuning.
[gbasedbt@devsvr ~]$ 

取消共享内存的常驻部分的强制驻留

[gbasedbt@devsvr ~]$ onmode -n
Your evaluation license will expire on 2022-06-18 00:00:00

This will set the shared memory buffer cache to NON-RESIDENT -
Do you wish to continue (y/n)? y
Note that this command will be phased out in a future release. Please use
the OpenAdmin Tool (OAT) or onmode -w[mf] for dynamic configuration tuning.
[gbasedbt@devsvr ~]$ 

—2.8 添加或删除虚拟管理器

GBase 8s可以根据业务运行情况,动态增加和减少虚拟处理器的数量,以适应业务变化,让数据库运行更高效。

onmode -p +num <vp_class>
onmode -p -num <vp_class>

查看当前的VP信息,当前的CPU VP共有2个。

[gbasedbt@devsvr ~]$ onstat -g glo
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 00:52:37 -- 597864 Kbytes

MT global info:
sessions threads  vps      lngspins time    
0        55       13       0        3156    

          sched calls     thread switches yield 0   yield n   yield forever
total:    136622          125911          223       116478    710      
per sec:  43              33              0         30        0        

Virtual processor summary:
 class       vps       usercpu   syscpu    total   
 cpu         2         0.77      2.63      3.40    
 aio         6         0.06      0.19      0.25    
 lio         1         0.00      0.05      0.05    
 pio         1         0.00      0.04      0.04    
 adm         1         0.01      0.32      0.33    
 msc         1         0.00      0.00      0.00    
 fifo        1         0.00      0.04      0.04    
 total       13        0.84      3.27      4.11    

Individual virtual processors:
 vp    pid       class       usercpu   syscpu    total     Thread    Eff  
 1     26606     cpu         0.55      2.28      2.83      3.32      85%
 2     26631     adm         0.01      0.32      0.33      0.00       0%
 3     26632     lio         0.00      0.05      0.05      0.05     100%
 4     26637     pio         0.00      0.04      0.04      0.04     100%
 5     26643     aio         0.00      0.05      0.05      0.05     100%
 6     26644     msc         0.00      0.00      0.00      0.00       0%
 7     26650     fifo        0.00      0.04      0.04      0.04     100%
 8     26656     cpu         0.22      0.35      0.57      0.57     100%
 9     26667     aio         0.01      0.03      0.04      0.04     100%
 10    26672     aio         0.00      0.04      0.04      0.04     100%
 11    26673     aio         0.02      0.02      0.04      0.04     100%
 12    26674     aio         0.01      0.03      0.04      0.04     100%
 13    26675     aio         0.02      0.02      0.04      0.04     100%
                 tot         0.84      3.27      4.11    

动态增加5个CPU VP。

[gbasedbt@devsvr ~]$ onmode -p +5 cpu
Your evaluation license will expire on 2022-06-18 00:00:00

再次查看VP信息,当前的CPU VP有7个。

[gbasedbt@devsvr ~]$ onstat -g glo
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 00:52:47 -- 597864 Kbytes

MT global info:
sessions threads  vps      lngspins time    
0        55       18       0        3166    

          sched calls     thread switches yield 0   yield n   yield forever
total:    137080          126335          228       116874    710      
per sec:  0               0               0         0         0        

Virtual processor summary:
 class       vps       usercpu   syscpu    total   
 cpu         7         0.78      2.63      3.41    
 aio         6         0.06      0.19      0.25    
 lio         1         0.00      0.05      0.05    
 pio         1         0.00      0.04      0.04    
 adm         1         0.01      0.32      0.33    
 msc         1         0.00      0.00      0.00    
 fifo        1         0.00      0.04      0.04    
 total       18        0.85      3.27      4.12    

Individual virtual processors:
 vp    pid       class       usercpu   syscpu    total     Thread    Eff  
 1     26606     cpu         0.55      2.28      2.83      3.82      74%
 2     26631     adm         0.01      0.32      0.33      0.00       0%
 3     26632     lio         0.00      0.05      0.05      0.05     100%
 4     26637     pio         0.00      0.04      0.04      0.04     100%
 5     26643     aio         0.00      0.05      0.05      0.05     100%
 6     26644     msc         0.00      0.00      0.00      0.00       0%
 7     26650     fifo        0.00      0.04      0.04      0.04     100%
 8     26656     cpu         0.23      0.35      0.58      0.58     100%
 9     26667     aio         0.01      0.03      0.04      0.04     100%
 10    26672     aio         0.00      0.04      0.04      0.04     100%
 11    26673     aio         0.02      0.02      0.04      0.04     100%
 12    26674     aio         0.01      0.03      0.04      0.04     100%
 13    26675     aio         0.02      0.02      0.04      0.04     100%
 14    39853     cpu         0.00      0.00      0.00      0.00       0%
 15    39854     cpu         0.00      0.00      0.00      0.00       0%
 16    39855     cpu         0.00      0.00      0.00      0.00       0%
 17    39856     cpu         0.00      0.00      0.00      0.00       0%
 18    39857     cpu         0.00      0.00      0.00      0.00       0%
                 tot         0.85      3.27      4.12    

动态减少3个CPU VP。

[gbasedbt@devsvr ~]$ onmode -p -3 cpu
Your evaluation license will expire on 2022-06-18 00:00:00

查看VP信息。CPU VP变为4个。

[gbasedbt@devsvr ~]$ onstat -g glo
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 00:53:35 -- 597864 Kbytes

MT global info:
sessions threads  vps      lngspins time    
0        55       15       0        3214    

          sched calls     thread switches yield 0   yield n   yield forever
total:    139105          128195          230       118615    710      
per sec:  0               0               0         0         0        

Virtual processor summary:
 class       vps       usercpu   syscpu    total   
 cpu         4         0.78      2.64      3.42    
 aio         6         0.06      0.19      0.25    
 lio         1         0.00      0.05      0.05    
 pio         1         0.00      0.04      0.04    
 adm         1         0.01      0.33      0.34    
 msc         1         0.00      0.00      0.00    
 fifo        1         0.00      0.04      0.04    
 total       15        0.85      3.29      4.14    

Individual virtual processors:
 vp    pid       class       usercpu   syscpu    total     Thread    Eff  
 1     26606     cpu         0.55      2.29      2.84      3.84      74%
 2     26631     adm         0.01      0.33      0.34      0.00       0%
 3     26632     lio         0.00      0.05      0.05      0.05     100%
 4     26637     pio         0.00      0.04      0.04      0.04     100%
 5     26643     aio         0.00      0.05      0.05      0.05     100%
 6     26644     msc         0.00      0.00      0.00      0.00       0%
 7     26650     fifo        0.00      0.04      0.04      0.04     100%
 8     26656     cpu         0.23      0.35      0.58      0.58     100%
 9     26667     aio         0.01      0.03      0.04      0.04     100%
 10    26672     aio         0.00      0.04      0.04      0.04     100%
 11    26673     aio         0.02      0.02      0.04      0.04     100%
 12    26674     aio         0.01      0.03      0.04      0.04     100%
 13    26675     aio         0.02      0.02      0.04      0.04     100%
 14    39853     cpu         0.00      0.00      0.00      0.00       0%
 15    39854     cpu         0.00      0.00      0.00      0.00       0%
                 tot         0.85      3.29      4.14    

[gbasedbt@devsvr ~]$ 

—2.9 动态地启动、停止或重启监听线程

onmode -P <start|stop|restart> <instance_name>

停止服务监听。

[gbasedbt@devsvr ~]$ onmode -P stop gbaseserver
Your evaluation license will expire on 2022-06-18 00:00:00

使用dbaccess连接数据库。由于监听已经停止,dbaccess会在选择数据库执行一段时间后报错。

[gbasedbt@devsvr ~]$ dbaccess - -
Your evaluation license will expire on 2022-06-18 00:00:00
> database mydb;

  908: Attempt to connect to database server (gbaseserver) failed.
Error in line 1
Near character position 1
> 

启动监听。再次使用dbaccess连接数据库会立即成功。

[gbasedbt@devsvr ~]$ onmode -P start gbaseserver
Your evaluation license will expire on 2022-06-18 00:00:00
[gbasedbt@devsvr ~]$ dbaccess - -
Your evaluation license will expire on 2022-06-18 00:00:00
> database mydb;

Database selected.

> 

—2.10 更新 onconfig 文件中指定配置参数的值

onmode -wm <key=value>
onmode -wf <key=value>

说明:只有部分参数支持动态更改。

只更新内存中的参数值,但不更新配置文件中的参数值。

[gbasedbt@devsvr gbaseserver_dbs]$ onmode -wm LISTEN_TIMEOUT=50
Your evaluation license will expire on 2022-06-18 00:00:00
Value of LISTEN_TIMEOUT has been changed to 50 seconds.
[gbasedbt@devsvr gbaseserver_dbs]$ onstat -g cfg LISTEN_TIMEOUT
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 01:33:54 -- 597864 Kbytes

name                      current value
LISTEN_TIMEOUT            50

[gbasedbt@devsvr gbaseserver_dbs]$ onstat -c | grep LISTEN_TIMEOUT
Your evaluation license will expire on 2022-06-18 00:00:00
# LISTEN_TIMEOUT             - The number of seconds that GBase
LISTEN_TIMEOUT 60
[gbasedbt@devsvr gbaseserver_dbs]$ 

更新内存和配置文件中的参数值。

[gbasedbt@devsvr gbaseserver_dbs]$ onstat -c | grep TAPEDEV
Your evaluation license will expire on 2022-06-18 00:00:00
# TAPEDEV      - The tape device path for backups. To use standard
TAPEDEV         /dev/null       
# LTAPEDEV     - The tape device path for logical logs
LTAPEDEV        /dev/null       
[gbasedbt@devsvr gbaseserver_dbs]$ onmode -wf TAPEDEV=/home/gbasedbt/backup
Your evaluation license will expire on 2022-06-18 00:00:00
Value of TAPEDEV has been changed to /home/gbasedbt/backup.
[gbasedbt@devsvr gbaseserver_dbs]$ onstat -c | grep TAPEDEV
Your evaluation license will expire on 2022-06-18 00:00:00
# TAPEDEV      - The tape device path for backups. To use standard
TAPEDEV         /home/gbasedbt/backup 
# LTAPEDEV     - The tape device path for logical logs
LTAPEDEV        /dev/null       
[gbasedbt@devsvr gbaseserver_dbs]$ 

—2.11 终止数据库服务器会话

onmode -z <session_id>
[gbasedbt@devsvr ~]$ onstat -g ses
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 1 days 02:46:43 -- 597864 Kbytes

session                                      #RSAM    total      used       dynamic 
id       user     tty      pid      hostname threads  memory     memory     explain 
29       gbasedbt -        0        -        0        16384      13712      off 
26       gbasedbt 11       27021    devsvr   1        237568     150144     off 
24       gbasedbt -        0        -        0        20480      15328      off 
2        gbasedbt -        0        -        0        16384      13712      off 

[gbasedbt@devsvr ~]$ onmode -z 26
Your evaluation license will expire on 2022-06-18 00:00:00
[gbasedbt@devsvr ~]$ onstat -g ses
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 1 days 02:47:17 -- 597864 Kbytes

session                                      #RSAM    total      used       dynamic 
id       user     tty      pid      hostname threads  memory     memory     explain 
29       gbasedbt -        0        -        0        16384      13712      off 
24       gbasedbt -        0        -        0        20480      15328      off 
2        gbasedbt -        0        -        0        16384      13712      off 

[gbasedbt@devsvr ~]$ 

在dbaccess中执行SQL时,由于Session被杀死,执行报错。

> info tables;


Table name



25582: Network connection is broken.
Error in line 1
Near character position 97
> 

3 onstat

—3.1 打印数据库当前运行模式

onstat -
[gbasedbt@train ~]$ onstat -
On-Line -- Up 3 days 06:20:54 -- 1135464 Kbytes

[gbasedbt@train ~]$ 

—3.2 打印onconfig文件内容

显示配置文件的内容。在输出中包含了配置文件的路径,可以通过该命令快速找到配置文件。

onstat -c
[gbasedbt@devsvr ~]$ onstat -c | grep -v '#' 
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 1 days 21:06:38 -- 1135464 Kbytes

Configuration File: /opt/gbase/etc/onconfig.gbaseserver


ROOTNAME rootdbs
ROOTPATH /opt/gbase/gbaseserver_dbs/rootdbs 
ROOTOFFSET 0
ROOTSIZE 204800 
MIRROR 0
MIRRORPATH $GBASEDBTDIR/tmp/demo_on.root_mirror
MIRROROFFSET 0
......
BUFFERPOOL default,buffers=10000,lrus=8,lru_min_dirty=50.00,lru_max_dirty=60.50
BUFFERPOOL size=2k,buffers=35000,lrus=32,lru_min_dirty=50,lru_max_dirty=60 
BUFFERPOOL size=16k,buffers=25000,lrus=64,lru_min_dirty=25,lru_max_dirty=30 
AUTO_CKPTS 0

[gbasedbt@devsvr ~]$ 

—3.3 打印系统在线日志最新信息

查看online日志的最新信息。在输出信息中,也包含了online日志的路径信息,可以根据该日志路径,查看online日志的完整内容。

onstat -m
[gbasedbt@devsvr ~]$ onstat -m
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 15:32:41 -- 597864 Kbytes

Message Log File: /opt/gbase/etc/online_gbaseserver.log
08:38:39  Checkpoint Statistics - Avg. Txn Block Time 0.000, # Txns blocked 0, Plog used 7, Llog used 2

08:44:39  Checkpoint Completed:  duration was 0 seconds.
08:44:39  Mon Jun 21 - loguniq 8, logpos 0x674018, timestamp: 0x68da0 Interval: 318

08:44:39  Maximum server connections 6 
08:44:39  Checkpoint Statistics - Avg. Txn Block Time 0.000, # Txns blocked 0, Plog used 0, Llog used 2

08:54:39  Checkpoint Completed:  duration was 0 seconds.
08:54:39  Mon Jun 21 - loguniq 8, logpos 0x676018, timestamp: 0x68dfb Interval: 319

08:54:39  Maximum server connections 6 
08:54:39  Checkpoint Statistics - Avg. Txn Block Time 0.000, # Txns blocked 0, Plog used 7, Llog used 2

09:08:39  Checkpoint Completed:  duration was 0 seconds.
09:08:39  Mon Jun 21 - loguniq 8, logpos 0x678018, timestamp: 0x68e07 Interval: 320

09:08:39  Maximum server connections 6 
09:08:39  Checkpoint Statistics - Avg. Txn Block Time 0.000, # Txns blocked 0, Plog used 7, Llog used 2


[gbasedbt@devsvr ~]$ 

—3.4 打印物理日志和逻辑日志使用状态

显示物理日志缓冲区,逻辑日志缓冲区,逻辑日志使用情况等。

onstat -l
[gbasedbt@devsvr ~]$ onstat -l
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 15:30:42 -- 597864 Kbytes

Physical Logging
Buffer bufused  bufsize  numpages   numwrits   pages/io
  P-1  7        1024     2007       268        7.49
      phybegin         physize    phypos     phyused    %used   
      3:53             99400      2292       7          0.01    

Logical Logging
Buffer bufused  bufsize  numrecs    numpages   numwrits   recs/pages pages/io
  L-1  0        512      81336      6643       624        12.2       10.6    
    Subsystem    numrecs    Log Space used
    OLDRSAM      80962      12209444      
    HA           269        11836         
    DDL          105        36540         

address          number   flags    uniqid   begin                size     used    %used
4713df88         4        U-B----  7        2:53                 5000     5000   100.00
4830e970         5        U---C-L  8        2:5053               5000     1656    33.12
4830e9d8         6        A------  0        2:10053              5000        0     0.00
4830ea40         7        A------  0        2:15053              5000        0     0.00
4830eaa8         8        A------  0        2:20053              5000        0     0.00
4830eb10         9        A------  0        2:25053              5000        0     0.00
4830eb78         10       A------  0        2:30053              5000        0     0.00
4830ebe0         11       A------  0        2:35053              5000        0     0.00
4830ec48         12       A------  0        2:40053              5000        0     0.00
4830ecb0         13       A------  0        2:45053              5000        0     0.00
4830ed18         14       A------  0        2:50053              5000        0     0.00
4830ed80         15       A------  0        2:55053              5000        0     0.00
4830ede8         16       A------  0        2:60053              5000        0     0.00
4830ee50         17       A------  0        2:65053              5000        0     0.00
4830eeb8         18       A------  0        2:70053              5000        0     0.00
4830ef20         19       A------  0        2:75053              5000        0     0.00
4830ef88         20       A------  0        2:80053              5000        0     0.00
46f1cf30         21       A------  0        2:85053              5000        0     0.00
46f1cf98         22       A------  0        2:90053              5000        0     0.00
46febf30         23       A------  0        2:95053              5000        0     0.00
 20 active, 20 total

[gbasedbt@devsvr ~]$

物理日志标题

逻辑日志标题

flags

—3.5 打印数据库空间和Chunk文件使用信息

查询数据库已经创建的数据库空间,及每个数据库空间的文件编号,文件数量,文件路径,文件大小,页大小等信息。

onstat -d
[gbasedbt@devsvr ~]$ onstat -d
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 15:22:42 -- 597864 Kbytes

Dbspaces
address          number   flags      fchunk   nchunks  pgsize   flags    owner    name
46feb028         1        0x70001    1        1        2048     N  BA    gbasedbt rootdbs
484c8110         2        0x60001    2        1        2048     N  BA    gbasedbt llogdbs
484c8340         3        0x70001    3        1        2048     N  BA    gbasedbt plogdbs
484c8570         4        0x68001    4        1        2048     N SBA    gbasedbt sbspace1
484c87a0         5        0x42001    5        1        16384    N TBA    gbasedbt tmpdbs1
484c89d0         6        0x42001    6        1        16384    N TBA    gbasedbt tmpdbs2
484c8c00         7        0x42001    7        1        16384    N TBA    gbasedbt tmpdbs3
484ca028         8        0x60001    8        1        16384    N  BA    gbasedbt datadbs1
484ca258         9        0x60001    9        1        16384    N  BA    gbasedbt datadbs2
484ca488         10       0x60001    10       1        16384    N  BA    gbasedbt datadbs3
484ca6b8         11       0x60001    11       1        16384    N  BA    gbasedbt datadbs4
484ca8e8         12       0x60001    12       1        16384    N  BA    gbasedbt datadbs5
 12 active, 2047 maximum

Chunks
address          chunk/dbs     offset     size       free       bpages     flags pathname
46feb258         1      1      0          102400     87514                 PO-B-D /opt/gbase/gbaseserver_dbs/rootdbs
484cb028         2      2      0          102400     2347                  PO-B-D /opt/gbase/gbaseserver_dbs/llogdbs
484cc028         3      3      0          102400     2947                  PO-B-D /opt/gbase/gbaseserver_dbs/plogdbs
484cd028         4      4      0          51200      47678      47678      POSB-D /opt/gbase/gbaseserver_dbs/sbspace1
                                 Metadata 3469       2581       3469    
484ce028         5      5      0          6400       6347                  PO-B-- /opt/gbase/gbaseserver_dbs/tmpdbs1
484d4028         6      6      0          6400       6347                  PO-B-- /opt/gbase/gbaseserver_dbs/tmpdbs2
484d5028         7      7      0          6400       6347                  PO-B-- /opt/gbase/gbaseserver_dbs/tmpdbs3
484d6028         8      8      0          6400       5817                  PO-BED /opt/gbase/gbaseserver_dbs/datadbs1_1
484d7028         9      9      0          6400       6347                  PO-BED /opt/gbase/gbaseserver_dbs/datadbs2_1
484d8028         10     10     0          6400       6347                  PO-BED /opt/gbase/gbaseserver_dbs/datadbs3_1
484d9028         11     11     0          6400       6347                  PO-BED /opt/gbase/gbaseserver_dbs/datadbs4_1
484da028         12     12     0          6400       6347                  PO-BED /opt/gbase/gbaseserver_dbs/datadbs5_1
 12 active, 32766 maximum

NOTE: The values in the "size" and "free" columns for DBspace chunks are
      displayed in terms of "pgsize" of the DBspace to which they belong.


Expanded chunk capacity mode: always

[gbasedbt@devsvr ~]$ 

标记值2(flags)

Chunks字段信息

chunk 状态信息标志说明

—3.6 打印数据库空间和Chunk文件读写信息

查询数据库已经创建的数据库空间,及每个数据库空间的文件编号,文件数量,文件路径,页大小,每个文件的IO情况等信息。

onstat -D
[gbasedbt@devsvr ~]$ onstat -D
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 15:24:44 -- 597864 Kbytes

Dbspaces
address          number   flags      fchunk   nchunks  pgsize   flags    owner    name
46feb028         1        0x70001    1        1        2048     N  BA    gbasedbt rootdbs
484c8110         2        0x60001    2        1        2048     N  BA    gbasedbt llogdbs
484c8340         3        0x70001    3        1        2048     N  BA    gbasedbt plogdbs
484c8570         4        0x68001    4        1        2048     N SBA    gbasedbt sbspace1
484c87a0         5        0x42001    5        1        16384    N TBA    gbasedbt tmpdbs1
484c89d0         6        0x42001    6        1        16384    N TBA    gbasedbt tmpdbs2
484c8c00         7        0x42001    7        1        16384    N TBA    gbasedbt tmpdbs3
484ca028         8        0x60001    8        1        16384    N  BA    gbasedbt datadbs1
484ca258         9        0x60001    9        1        16384    N  BA    gbasedbt datadbs2
484ca488         10       0x60001    10       1        16384    N  BA    gbasedbt datadbs3
484ca6b8         11       0x60001    11       1        16384    N  BA    gbasedbt datadbs4
484ca8e8         12       0x60001    12       1        16384    N  BA    gbasedbt datadbs5
 12 active, 2047 maximum

Chunks
address          chunk/dbs     offset     page Rd  page Wr  pathname
46feb258         1      1      0          1063     3651     /opt/gbase/gbaseserver_dbs/rootdbs
484cb028         2      2      0          515      6644     /opt/gbase/gbaseserver_dbs/llogdbs
484cc028         3      3      0          11       2008     /opt/gbase/gbaseserver_dbs/plogdbs
484cd028         4      4      0          11       1        /opt/gbase/gbaseserver_dbs/sbspace1
484ce028         5      5      0          24       384      /opt/gbase/gbaseserver_dbs/tmpdbs1
484d4028         6      6      0          24       408      /opt/gbase/gbaseserver_dbs/tmpdbs2
484d5028         7      7      0          24       384      /opt/gbase/gbaseserver_dbs/tmpdbs3
484d6028         8      8      0          1144     3344     /opt/gbase/gbaseserver_dbs/datadbs1_1
484d7028         9      9      0          24       8        /opt/gbase/gbaseserver_dbs/datadbs2_1
484d8028         10     10     0          24       8        /opt/gbase/gbaseserver_dbs/datadbs3_1
484d9028         11     11     0          24       8        /opt/gbase/gbaseserver_dbs/datadbs4_1
484da028         12     12     0          24       8        /opt/gbase/gbaseserver_dbs/datadbs5_1
 12 active, 32766 maximum

NOTE: The values in the "page Rd" and "page Wr" columns for DBspace chunks 
      are displayed in terms of system base  page size.


Expanded chunk capacity mode: always

[gbasedbt@devsvr ~]$

—3.7 打印表空间信息

显示活动表空间的表空间信息。

onstat -t
[gbasedbt@devsvr ~]$ onstat -t
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 15:44:11 -- 597864 Kbytes

Tblspaces
 n address          flgs ucnt tblnum   physaddr         npages nused  npdata nrows  nextns
11 484cab18         0    1    100001   1:14             600    547    0      544    4     
410 49427570         0    2    100190   1:50601          16     15     8      79     2     
486 49593028         0    1    1001dc   1:50677          8      2      1      11     1     
487 49593650         0    1    1001dd   1:50678          16     13     7      78     2     
556 486aa028         0    1    200001   2:4              50     2      0      0      1     
557 486aa778         0    1    300001   3:4              50     2      0      0      1     
558 486ab028         0    1    400001   4:4              50     6      0      4      1     
563 486b2028         2    1    500001   5:32             50     3      0      0      1     
564 486b2908         2    1    600001   6:32             50     3      0      0      1     
565 486b3028         2    1    700001   7:32             50     3      0      0      1     
566 486b3778         0    1    800001   8:32             100    71     0      69     2     
636 486b4028         0    1    900001   9:32             50     2      0      0      1     
637 486b4778         0    1    a00001   10:32            50     2      0      0      1     
638 486b5028         0    1    b00001   11:32            50     2      0      0      1     
639 486b5778         0    1    c00001   12:32            50     2      0      0      1     
 15 active, 639 total

[gbasedbt@devsvr ~]$ 

—3.8 显示全部表空间的表空间信息

onstat -T
[gbasedbt@devsvr ~]$ onstat -T
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 15:45:20 -- 597864 Kbytes

Tblspaces
 n address          flgs ucnt tblnum   physaddr         npages nused  npdata nrows  nextns
 1 49d08ad8         8    0    a        0:0              0      0      0      0      0     
 2 4955c028         8    0    f        0:0              0      0      0      0      0     
 3 49617028         8    0    17       0:0              0      0      0      0      0     
 4 49617a18         8    0    18       0:0              0      0      0      0      0     
 5 4957a028         8    0    19       0:0              0      0      0      0      0     
 6 4957a520         8    0    1a       0:0              0      0      0      0      0     
 7 49617520         8    0    1c       0:0              0      0      0      0      0     
 8 49d08028         8    0    28       0:0              0      0      0      0      0     
 9 49d08520         8    0    3f       0:0              0      0      0      0      0     
10 4951d028         8    0    42       0:0              0      0      0      0      0     
11 484cab18         0    1    100001   1:14             600    547    0      544    4     
12 4a19d050         0    0    100002   1:15             4      3      1      7      1     
13 4957aa18         0    0    100003   1:16             16     16     15     270    1     
14 4a19d848         0    0    100004   1:17             64     50     25     275    4     
15 494fd1e0         0    0    100005   1:18             168    132    78     3086   3     
16 4964f740         0    0    100006   1:19             128    91     55     214    2     
17 49415900         0    0    100007   1:20             64     38     13     298    2     
18 494fe8d8         0    0    100008   1:21             32     17     7      162    3     
19 4951d520         0    0    100009   1:22             32     22     18     120    3     
20 4a2d0028         0    0    10000a   1:23             8      3      1      2      1     
......
637 486b4778         0    1    a00001   10:32            50     2      0      0      1     
638 486b5028         0    1    b00001   11:32            50     2      0      0      1     
639 486b5778         0    1    c00001   12:32            50     2      0      0      1     
 15 active, 639 total

[gbasedbt@devsvr ~]$ 

—3.9 打印锁信息

onstat -k
[gbasedbt@devsvr ~]$ onstat -k
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 21:32:59 -- 597864 Kbytes

Locks
address          wtlist           owner            lklist           type     tblsnum  rowid    key#/bsiz
44377028         0                470f1568           0                HDR+S    100002   206         0       
443770b0         0                470f1568           44377028         HDR+IX   800090   0           0       
44377138         0                470f1568           443770b0         HDR+X    800090   4c9cd8      0    I  
4506f528         0                470f4128           0                HDR+S    100002   205         0       
 4 active, 200000 total, 65536 hash buckets, 0 lock table overflows

[gbasedbt@devsvr ~]$ 

—3.10 打印系统运行状态统计

显示数据库运行时的一些重要统计信息。

onstat -p
[gbasedbt@devsvr ~]$ onstat -p
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 15:34:46 -- 597864 Kbytes

Profile
dskreads   pagreads   bufreads   %cached dskwrits   pagwrits   bufwrits   %cached
1234       2912       1946606    99.94   5120       16867      90921      94.37  

isamtot    open       start      read       write      rewrite    delete     commit     rollbk
1208363    88057      114244     714826     30696      2073       42         77         2

gp_read    gp_write   gp_rewrt   gp_del     gp_alloc   gp_free    gp_curs   
2          0          0          0          0          0          2         

ovlock     ovuserthread ovbuff     usercpu  syscpu   numckpts   flushes   
0          0            0          21.90    53.06    270        540       

bufwaits   lokwaits   lockreqs   deadlks    dltouts    ckpwaits   compress   seqscans  
0          0          2058739    0          0          0          1380       3213      

ixda-RA    idx-RA     da-RA      logrec-RA  RA-pgsused lchwaits  
0          0          0          2          0          16      

[gbasedbt@devsvr ~]$ 

—3.11 重复运行命令

可以使用-r参数,每隔指定秒数,执行一次命令。

onstat -r <seconds>
[gbasedbt@devsvr ~]$ onstat -r 1
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 15:39:52 -- 597864 Kbytes

On-Line -- Up 2 days 15:39:53 -- 597864 Kbytes

On-Line -- Up 2 days 15:39:54 -- 597864 Kbytes

On-Line -- Up 2 days 15:39:55 -- 597864 Kbytes

On-Line -- Up 2 days 15:39:56 -- 597864 Kbytes

On-Line -- Up 2 days 15:39:57 -- 597864 Kbytes

—3.12 打印用户线程

onstat -u
[gbasedbt@devsvr ~]$ onstat -u
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 15:50:27 -- 597864 Kbytes

Userthreads
address          flags   sessid   user     tty      wait             tout locks nreads   nwrites
470dc028         ---P--D 1        gbasedbt -        0                0    0     117      2875
470dc8e8         ---P--F 0        gbasedbt -        0                0    0     0        7127
470dd1a8         ---P--F 0        gbasedbt -        0                0    0     0        385
470dda68         ---P--F 0        gbasedbt -        0                0    0     0        345
470de328         ---P--F 0        gbasedbt -        0                0    0     0        9
......
470f0ca8         ---P--D 12       gbasedbt -        0                0    0     0        0
470f1568         Y--P--- 54       gbasedbt 4        498e0ef8         0    1     0        0
470f1e28         ---P--D 13       gbasedbt -        0                0    0     2        0
470f26e8         ---P--D 14       gbasedbt -        0                0    0     0        0
470f4128         Y--P--- 25       gbasedbt 3        496de610         0    1     0        0
470f49e8         Y--P--- 52       gbasedbt 4        49580388         0    1     0        0
 44 active, 256 total, 137 maximum concurrent

[gbasedbt@devsvr ~]$ 

flags说明

—3.13 打印事务

onstat -x
[gbasedbt@devsvr ~]$ onstat -x
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 21:34:39 -- 597864 Kbytes

Transactions
                                                                                           est.    
address          flags userthread       locks  begin_logpos      current logpos    isol    rb_time  retrys coord
47123028         A---- 470dc028         0      -                 -                 COMMIT  -        0      
47123378         A---- 470dc8e8         0      -                 -                 COMMIT  -        0      
471236c8         A---- 470dd1a8         0      -                 -                 COMMIT  -        0      
......   
4712aab8         A---- 470f03e8         0      -                 -                 COMMIT  -        0      
4712ae08         A-B-- 470f1568         3      1035:0xaf018      1035:0xaf050      LC      00:00:00 0      
4712b158         A---- 470f0ca8         0      -                 -                 COMMIT  -        0      
4712b4a8         A---- 470f1e28         0      -                 -                 COMMIT  -        0      
4712b7f8         A---- 470f26e8         0      -                 -                 COMMIT  -        0      
4712c1e8         A---- 470f4128         1      -                 -                 LC      -        0      
 43 active, 128 total, 45 maximum concurrent

[gbasedbt@devsvr ~]$ 

flags标志说明

—3.14 打印操作系统的信息

onstat -g osi
[gbasedbt@devsvr ~]$ onstat -g osi
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 21:31:11 -- 597864 Kbytes


Machine Configuration....
OS Name					Linux
OS Release				3.10.0-514.el7.x86_64
OS Node Name				devsvr
OS Version				#1 SMP Tue Nov 22 16:42:41 UTC 2016
OS Machine				x86_64
Number of processors			2
Number of online processors		2
System memory page size			4096 bytes
System memory 				1823 MB
System free memory			1254 MB
Number of open files per process	1024
shmmax                                  9223372036854775807
shmmin                                  1
shmids                                  4096
shmNumSegs                              9223372036854775807
semmap                                  <<  UnSupported  >>
semids                                  128
semnum                                  32000
semundo                                 <<  UnSupported  >>
semNumPerID                             250
semops                                  32
semUndoPerProc                          <<  UnSupported  >>
semUndoSize                             20
semMaxValue                             32767

[gbasedbt@devsvr ~]$ 

—3.15 打印环境变量值

onstat -g env
[gbasedbt@devsvr ~]$ onstat -g env
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 21:32:19 -- 597864 Kbytes

Server start-up environment:

Variable            Value [values-list]
CLIENT_LOCALE       zh_CN.utf8
DBDELIMITER         |
DBPATH              .
DBPRINT             lp -s
DBTEMP              /tmp
DB_LOCALE           zh_CN.utf8
GBASEDBTDIR         /opt/gbase
                    [/opt/gbase]
                    [/usr/gbasedbt]
GBASEDBTSERVER      gbaseserver
GBASEDBTSQLHOSTS    /opt/gbase/etc/sqlhosts.gbaseserver
GBASEDBTTERM        terminfo
IGNORE_UNDERFLOW    1
LANG                en_US.UTF-8
LC_COLLATE          en_US.UTF-8
LC_CTYPE            en_US.UTF-8
LC_MONETARY         en_US.UTF-8
LC_NUMERIC          en_US.UTF-8
LC_TIME             en_US.UTF-8
LKNOTIFY            yes
LOCKDOWN            no
NODEFDAC            no
ONCONFIG            onconfig.gbaseserver
PATH                /opt/gbase/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr
                     /sbin:/home/gbasedbt/.local/bin:/home/gbasedbt/bin
SERVER_LOCALE       en_US.819
SHELL               /bin/bash
TERM                xterm
                    [xterm]
                    [dumb]
TERMCAP             /etc/termcap


[gbasedbt@devsvr ~]$ 

—3.16 打印配置参数的当前值

onstat -g cfg [full | diff | tunable | msg] [param_name]
[gbasedbt@devsvr ~]$ onstat -g cfg
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 21:34:26 -- 597864 Kbytes

Configuration Parameter List

name                      current value
ROOTNAME                  rootdbs
ROOTPATH                  /opt/gbase/gbaseserver_dbs/rootdbs
ROOTOFFSET                0
ROOTSIZE                  204800
......
CDR_AUTO_DISCOVER         0
IFXGUARD                  enable=1,timeout=-1
SYSSYNCCACH               0
ENABLE_NULL_STRCAT        1
ENABLE_NULL_STRING        1
ENABLE_QUERY_LIMIT_ZERO   0
STARTWITH_OPTIMIZE_MODE   1

[gbasedbt@devsvr ~]$ 

—3.17 打印 checkpoint 历史记录和配置建议

语法

onstat -g ckp

示例

[gbasedbt@devsvr ~]$ onstat -g ckp
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 21:39:20 -- 597864 Kbytes

AUTO_CKPTS=Off   RTO_SERVER_RESTART=Off   

                                                                    Critical Sections                          Physical Log    Logical Log    
           Clock                                  Total Flush Block #      Ckpt  Wait  Long  # Dirty   Dskflu  Total    Avg    Total    Avg   
Interval   Time      Trigger    LSN               Time  Time  Time  Waits  Time  Time  Time  Buffers   /Sec    Pages    /Sec   Pages    /Sec  
1880       08:44:28  CKPTINTVL  1036:0x6018       0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       7        0      2        0     
1881       09:00:28  CKPTINTVL  1036:0x8018       0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       7        0      2        0     
1882       09:14:29  CKPTINTVL  1036:0xa018       0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       7        0      2        0     
1883       09:30:30  CKPTINTVL  1036:0xc018       0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       7        0      2        0     
1884       09:44:30  CKPTINTVL  1036:0xe018       0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       7        0      2        0     
1885       10:00:31  CKPTINTVL  1036:0x10018      0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       7        0      2        0     
1886       10:14:32  CKPTINTVL  1036:0x12018      0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       7        0      2        0     
1887       10:30:33  CKPTINTVL  1036:0x14018      0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       7        0      2        0     
1888       10:44:33  CKPTINTVL  1036:0x16018      0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       7        0      2        0     
1889       11:00:34  CKPTINTVL  1036:0x18018      0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       7        0      2        0     
1890       11:14:35  CKPTINTVL  1036:0x1a018      0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       7        0      2        0     
1891       11:30:35  CKPTINTVL  1036:0x1c018      0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       7        0      2        0     
1892       11:44:36  CKPTINTVL  1036:0x1e018      0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       7        0      2        0     
1893       12:00:37  CKPTINTVL  1036:0x20018      0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       7        0      2        0     
1894       12:14:37  CKPTINTVL  1036:0x22018      0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       7        0      2        0     
1895       12:30:38  CKPTINTVL  1036:0x24018      0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       7        0      2        0     
1896       12:44:39  CKPTINTVL  1036:0x26018      0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       7        0      2        0     
1897       13:00:40  CKPTINTVL  1036:0x28018      0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       7        0      2        0     
1898       13:14:40  CKPTINTVL  1036:0x2a018      0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       7        0      2        0     
1899       13:30:41  CKPTINTVL  1036:0x2c018      0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       7        0      2        0     

Max Plog       Max Llog       Max Dskflush   Avg Dskflush   Avg Dirty      Blocked      
pages/sec      pages/sec      Time           pages/sec      pages/sec      Time         
200            200            1              1              0              0            

[gbasedbt@devsvr ~]$ 

—3.18 打印归档状态

语法

onstat -g arc

示例

[gbasedbt@devsvr ~]$ onstat -g arc
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 23:10:46 -- 597864 Kbytes


num   DBSpace            Q Size Q Len  Buffer partnum    size     scanner 

Dbspaces - Archive Status
name               number level date             log        log-position
rootdbs            1      0     07/26/2021.16:29 1034       0xae018   
                          1     07/24/2021.10:17 33         0xbe3018  
                          2     07/24/2021.10:20 33         0xbec018  
llogdbs            2      0     07/26/2021.16:29 1034       0xae018   
                          1     07/24/2021.10:17 33         0xbe3018  
                          2     07/24/2021.10:20 33         0xbec018  
plogdbs            3      0     07/26/2021.16:29 1034       0xae018   
                          1     07/24/2021.10:17 33         0xbe3018  
                          2     07/24/2021.10:20 33         0xbec018  
sbspace1           4      0     07/26/2021.16:29 1034       0xae018   
                          1     07/24/2021.10:17 33         0xbe3018  
                          2     07/24/2021.10:20 33         0xbec018  
datadbs1           8      0     07/26/2021.16:29 1034       0xae018   
                          1     07/24/2021.10:17 33         0xbe3018  
                          2     07/24/2021.10:20 33         0xbec018  
datadbs2           9      0     07/26/2021.16:29 1034       0xae018   
                          1     07/24/2021.10:17 33         0xbe3018  
                          2     07/24/2021.10:20 33         0xbec018  
datadbs3           10     0     07/26/2021.16:29 1034       0xae018   
                          1     07/24/2021.10:17 33         0xbe3018  
                          2     07/24/2021.10:20 33         0xbec018  
datadbs4           11     0     07/26/2021.16:29 1034       0xae018   
                          1     07/24/2021.10:17 33         0xbe3018  
                          2     07/24/2021.10:20 33         0xbec018  
datadbs5           12     0     07/26/2021.16:29 1034       0xae018   
                          1     07/24/2021.10:17 33         0xbe3018  
                          2     07/24/2021.10:20 33         0xbec018  

[gbasedbt@devsvr ~]$ 

说明

—3.19 打印所有线程的信息

onstat -g ath
[gbasedbt@devsvr ~]$ onstat -g ath
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 21:54:33 -- 597864 Kbytes

Threads:
 tid     tcb              rstcb            prty status                vp-class       name
 2        47ed0c88         0                1    IO Idle                 3lio*        lio vp 0
 3        47ef1368         0                1    IO Idle                 4pio*        pio vp 0
 4        47f12368         0                1    IO Idle                 5aio*        aio vp 0
 5        47f33368         20e1f00          1    IO Idle                 6msc*        msc vp 0
 6        47f64368         0                1    IO Idle                 7fifo*       fifo vp 0
 7        47f8cd30         470dc028         3    sleeping secs: 1        8cpu         main_loop()
 8        47feb418         0                1    running                 1cpu*        soctcppoll
 10       48173748         470dc8e8         1    sleeping secs: 1        8cpu         flush_sub(0)
 11       48173a88         470dd1a8         1    sleeping secs: 1        8cpu         flush_sub(1)
 ......
 39       4848da38         470ec6a8         1    sleeping secs: 1        8cpu         flush_sub(29)
 40       484fa028         470ecf68         1    sleeping secs: 1        8cpu         flush_sub(30)
 41       484fa3b8         470ed828         1    sleeping secs: 1        8cpu         flush_sub(31)
 42       484fa748         0                3    IO Idle                 1cpu*        kaio
 43       484faad8         0                3    IO Idle                 8cpu*        kaio
 44       48616d48         0                1    IO Idle                 9aio*        aio vp 1
 45       48649368         0                1    IO Idle                10aio*        aio vp 2
 46       4866a368         0                1    IO Idle                11aio*        aio vp 3
 47       4868b368         0                1    IO Idle                12aio*        aio vp 4
 48       486ac368         0                1    IO Idle                13aio*        aio vp 5
 49       486cd758         470ee0e8         2    sleeping secs: 1        8cpu         aslogflush
 51       4868bce0         470ef268         3    cond wait  ReadAhead   14cpu         readahead_0
 52       486316c8         470efb28         3    sleeping secs: 1        8cpu         auto_tune
 155      494bcbc8         470f0ca8         3    sleeping secs: 1        1cpu*        onmode_mon
 156      487fc7f0         470f1e28         3    sleeping secs: 1        8cpu         periodic
 157      487fcc70         470f26e8         3    sleeping forever        1cpu         memory
 166      4a305028         470f03e8         1    cond wait  bp_cond      8cpu         bf_priosweep()
 170      4a21dbe0         0                3    IO Idle                14cpu*        kaio
 171      494c8368         0                2    sleeping forever        8cpu*        soctcplst
 173      4a433860         0                3    IO Idle                15cpu*        kaio
 189      49b32028         470f1568         1    yield time             14cpu         btscanner_0
 191      49d15370         470ee9a8         1    cond wait  netnorm      1cpu         sqlexec


[gbasedbt@devsvr ~]$ 

—3.20 打印活动线程

onstat -g act
[gbasedbt@devsvr ~]$ onstat -g act
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 22:21:11 -- 597864 Kbytes

Running threads:
 tid     tcb              rstcb            prty status                vp-class       name
 8        47feb418         0                1    running                 1cpu*        soctcppoll


[gbasedbt@devsvr ~]$ 

—3.21 打印阻塞的和正在等待的线程

onstat -g bth
[gbasedbt@devsvr ~]$ onstat -g bth
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 22:20:59 -- 597864 Kbytes

This command attempts to identify any blocking threads.

No blocking thread identified.

Threads waiting on resources
 tid      name                 blocking resource              blocker 
 51       readahead_0          Condition (ReadAhead)           -      
 166      bf_priosweep()       Condition (bp_cond)             -      
 191      sqlexec              Condition (netnorm)             -      

[gbasedbt@devsvr ~]$

—3.22 打印缓冲池的概要文件信息

onstat -g buf
[gbasedbt@devsvr ~]$ onstat -g buf
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 22:55:32 -- 597864 Kbytes

Profile

Buffer pool page size: 2048
dskreads   pagreads   bufreads   %cached dskwrits   pagwrits   bufwrits   %cached
336        859        5072       93.38   1485       3837       298        0.00   
bufwrits_sinceckpt  bufwaits   ovbuff     flushes   
0                   0          0          284       

Fg Writes     LRU Writes    Avg. LRU Time Chunk Writes  Total Mem
0             0             -nan          288           76Mb    

Bufferpool Segments
id segment      size     # buffs  
0  0x4af75000   76Mb     35001    

----------------------------------

Buffer pool page size: 16384
dskreads   pagreads   bufreads   %cached dskwrits   pagwrits   bufwrits   %cached
118        984        1738       93.21   107        856        222        51.80  
bufwrits_sinceckpt  bufwaits   ovbuff     flushes   
0                   2          0          6         

Fg Writes     LRU Writes    Avg. LRU Time Chunk Writes  Total Mem
0             0             -nan          91            395Mb   

Bufferpool Segments
id segment      size     # buffs  
0  0x4fbe9000   395Mb    25000    

----------------------------------

Fast Cache Stats
gets       hits       %hits   puts      
498        367        73.69   1955      

[gbasedbt@devsvr ~]$ 

—3.23 打印运行时间统计信息

onstat -g cpu
[gbasedbt@devsvr ~]$ onstat -g cpu
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 23:31:44 -- 597864 Kbytes

Thread CPU Info:
 tid    name              vp       Last Run           CPU Time     #scheds    status
 2      lio vp 0          3lio*   07/26 15:59:07        0.0000          1    IO Idle              
 3      pio vp 0          4pio*   07/26 15:59:08        0.1006          2    IO Idle              
 4      aio vp 0          5aio*   07/26 17:43:57        0.1407        137    IO Idle              
 5      msc vp 0          6msc*   07/27 13:30:54        0.0138          9    IO Idle              
 6      fifo vp 0         7fifo*  07/26 15:59:11        0.1011          2    IO Idle              
 7      main_loop()       8cpu    07/27 15:30:48        0.4311      85244    sleeping secs: 1     
 8      soctcppoll        1cpu*   07/27 15:30:48    84693.6191     369436    running              
 10     flush_sub(0)      8cpu    07/27 15:30:48        0.0986      84835    sleeping secs: 1     
 11     flush_sub(1)      8cpu    07/27 15:30:48        0.0743      84644    sleeping secs: 1     
 12     flush_sub(2)      8cpu    07/27 15:30:48        0.0778      84644    sleeping secs: 1     
 13     flush_sub(3)      8cpu    07/27 15:30:48        0.0777      84644    sleeping secs: 1     
 14     flush_sub(4)      8cpu    07/27 15:30:48        0.0779      84642    sleeping secs: 1     
 15     flush_sub(5)      8cpu    07/27 15:30:48        0.0834      84642    sleeping secs: 1     
 16     flush_sub(6)      8cpu    07/27 15:30:48        0.0815      84642    sleeping secs: 1     
 17     flush_sub(7)      8cpu    07/27 15:30:48        0.1031      84640    sleeping secs: 1     
 18     flush_sub(8)      8cpu    07/27 15:30:48        0.0823      84639    sleeping secs: 1     
 19     flush_sub(9)      8cpu    07/27 15:30:48        0.0734      84639    sleeping secs: 1     
 20     flush_sub(10)     8cpu    07/27 15:30:48        0.0742      84639    sleeping secs: 1     
 21     flush_sub(11)     8cpu    07/27 15:30:48        0.0832      84639    sleeping secs: 1     
 22     flush_sub(12)     8cpu    07/27 15:30:48        0.0785      84639    sleeping secs: 1     
 23     flush_sub(13)     8cpu    07/27 15:30:48        0.0758      84640    sleeping secs: 1     
 24     flush_sub(14)     8cpu    07/27 15:30:48        0.0781      84640    sleeping secs: 1     
 25     flush_sub(15)     8cpu    07/27 15:30:48        0.0756      84640    sleeping secs: 1     
 26     flush_sub(16)     8cpu    07/27 15:30:48        0.0776      84640    sleeping secs: 1     
 27     flush_sub(17)     8cpu    07/27 15:30:48        0.0715      84640    sleeping secs: 1     
 28     flush_sub(18)     8cpu    07/27 15:30:48        0.0862      84640    sleeping secs: 1     
 29     flush_sub(19)     8cpu    07/27 15:30:48        0.0728      84640    sleeping secs: 1     
 30     flush_sub(20)     8cpu    07/27 15:30:48        0.0783      84639    sleeping secs: 1     
 31     flush_sub(21)     8cpu    07/27 15:30:48        0.0789      84639    sleeping secs: 1     
 32     flush_sub(22)     8cpu    07/27 15:30:48        0.0760      84639    sleeping secs: 1     
 33     flush_sub(23)     8cpu    07/27 15:30:48        0.0774      84639    sleeping secs: 1     
 34     flush_sub(24)     8cpu    07/27 15:30:48        0.0848      84639    sleeping secs: 1     
 35     flush_sub(25)    14cpu    07/27 15:30:48        0.0703      84639    sleeping secs: 1     
 36     flush_sub(26)     8cpu    07/27 15:30:48        0.0767      84639    sleeping secs: 1     
 37     flush_sub(27)     8cpu    07/27 15:30:48        0.0776      84639    sleeping secs: 1     
 38     flush_sub(28)     8cpu    07/27 15:30:48        0.0749      84639    sleeping secs: 1     
 39     flush_sub(29)     8cpu    07/27 15:30:48        0.0865      84639    sleeping secs: 1     
 40     flush_sub(30)     8cpu    07/27 15:30:48        0.0709      84639    sleeping secs: 1     
 41     flush_sub(31)     8cpu    07/27 15:30:48        0.0795      84640    sleeping secs: 1     
 42     kaio              1cpu*   07/27 15:00:41        0.1798        935    IO Idle              
 43     kaio              8cpu*   07/27 15:30:43        0.1981        567    IO Idle              
 44     aio vp 1          9aio*   07/26 15:59:17        0.1159          4    IO Idle              
 45     aio vp 2         10aio*   07/26 15:59:17        0.1014          4    IO Idle              
 46     aio vp 3         11aio*   07/26 15:59:17        0.1022          4    IO Idle              
 47     aio vp 4         12aio*   07/26 15:59:17        0.1017          4    IO Idle              
 48     aio vp 5         13aio*   07/26 15:59:17        0.1008          3    IO Idle              
 49     aslogflush        8cpu    07/27 15:30:48        0.2465      84637    sleeping secs: 1     
 50     btscanner_0      14cpu    07/27 15:28:00        0.5734       1796    sleeping secs: 12    
 51     readahead_0      15cpu    07/27 15:29:17        0.0016        288    cond wait  ReadAhead 
 52     auto_tune         8cpu    07/27 15:30:48        0.1892      84637    sleeping secs: 1     
 155    onmode_mon        1cpu*   07/27 15:30:48        1.0442      84681    sleeping secs: 1     
 156    periodic          8cpu    07/27 15:30:48        0.7170      84651    sleeping secs: 1     
 157    memory            1cpu    07/26 15:59:17        0.0000          0    sleeping forever     
 166    bf_priosweep()    8cpu    07/27 15:30:43        0.5565       4231    cond wait  bp_cond   
 170    kaio             14cpu*   07/27 15:00:41        0.1471        328    IO Idle              
 171    soctcplst         8cpu*   07/27 13:30:54        0.2568         19    sleeping forever     
 173    kaio             15cpu*   07/27 15:14:42        0.0791        147    IO Idle              
 174    sqlexec           1cpu    07/27 13:31:44        0.0681        536    cond wait  netnorm   
 176    sqlexec           1cpu    07/27 13:30:54        0.0012         14    cond wait  netnorm   


[gbasedbt@devsvr ~]$ 

—3.24 打印数据库服务器信息

onstat -g dis
[gbasedbt@devsvr ~]$ onstat -g dis
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 23:06:28 -- 597864 Kbytes
There are 1 servers found
Server        : gbaseserver
Server Number : 120
Server Type   : IDS
Server Status : Up
Server Version: GBase Database Server Version 12.10.FC4G1TL
Shared Memory : 0x44000000
GBASEDBTDIR   : /opt/gbase
ONCONFIG      : /opt/gbase/etc/onconfig.gbaseserver
SQLHOSTS      : /opt/gbase/etc/sqlhosts.gbaseserver
Host          : devsvr


[gbasedbt@devsvr ~]$ 

—3.25 打印高可用性数据复制信息

onstat -g dri
[gbasedbt@devsvr ~]$ onstat -g dri
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 23:08:03 -- 597864 Kbytes

Data Replication at 0x47fb3028: 
  Type           State        Paired server        Last DR CKPT (id/pg)    Supports Proxy Writes   
  standard       off                                       -1 / -1         NA

  DRINTERVAL   0 
  DRTIMEOUT    30 
  DRAUTO       0 
  DRLOSTFOUND  /opt/gbase/etc/dr.lostfound 
  DRIDXAUTO    0 
  ENCRYPT_HDR  0 
  Backlog      0 

[gbasedbt@devsvr ~]$ 

—3.26 打印全局多线程信息

[gbasedbt@devsvr ~]$ onstat -g glo
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 16:27:57 -- 597864 Kbytes

MT global info:
sessions threads  vps      lngspins time    
3        58       13       0        232077  

          sched calls     thread switches yield 0   yield n   yield forever
total:    10252370        9310184         178846    8588836   16242    
per sec:  25              15              0         12        0        

Virtual processor summary:
 class       vps       usercpu   syscpu    total   
 cpu         2         17.46     32.03     49.49   
 aio         6         2.65      7.84      10.49   
 lio         1         0.58      1.05      1.63    
 pio         1         0.45      1.23      1.68    
 adm         1         0.51      10.35     10.86   
 msc         1         0.00      0.00      0.00    
 fifo        1         0.50      1.19      1.69    
 total       13        22.15     53.69     75.84   

Individual virtual processors:
 vp    pid       class       usercpu   syscpu    total     Thread    Eff  
 1     54621     cpu         13.32     21.61     34.93     34.93    100%
 2     59541     adm         0.51      10.35     10.86     0.00       0%
 3     59571     lio         0.58      1.05      1.63      1.63     100%
 4     62715     pio         0.45      1.23      1.68      1.68     100%
 5     65914     aio         0.27      1.58      1.85      1.85     100%
 6     69103     msc         0.00      0.00      0.00      0.01       0%
 7     72316     fifo        0.50      1.19      1.69      1.69     100%
 8     75520     cpu         4.14      10.42     14.56     14.56    100%
 9     78756     aio         0.39      1.25      1.64      1.64     100%
 10    79077     aio         0.37      1.38      1.75      1.75     100%
 11    79405     aio         0.44      1.30      1.74      1.74     100%
 12    79732     aio         0.68      1.06      1.74      1.74     100%
 13    80058     aio         0.50      1.27      1.77      1.77     100%
                 tot         22.15     53.69     75.84   

[gbasedbt@devsvr ~]$ 

虚拟处理器摘要

Virtual Processor Summary

Individual virtual processors

—3.27 显示异步IO统计信息

onstat -g iof
[gbasedbt@devsvr ~]$ onstat -g iof
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 1 days 00:14:43 -- 597864 Kbytes

AIO global files:
gfd pathname         bytes read     page reads  bytes write    page writes io/s
3   rootdbs          638976         312         448512         219         2995.7
    op type     count          avg. time
    seeks       0              N/A
    reads       0              N/A
    writes      0              N/A
    kaio_reads  311            0.0003
    kaio_writes 219            0.0004

4   llogdbs          1056768        516         438272         214         2143.3
    op type     count          avg. time
    seeks       0              N/A
    reads       0              N/A
    writes      0              N/A
    kaio_reads  5              0.0009
    kaio_writes 211            0.0005

5   plogdbs          24576          12          2195456        1072        506.0
    op type     count          avg. time
    seeks       0              N/A
    reads       0              N/A
    writes      0              N/A
    kaio_reads  5              0.0003
    kaio_writes 103            0.0021

6   sbspace1         24576          12          6144           3           2454.1
    op type     count          avg. time
    seeks       0              N/A
    reads       0              N/A
    writes      0              N/A
    kaio_reads  12             0.0004
    kaio_writes 3              0.0002

7   tmpdbs1          16384          8           98304          48          10923.9
    op type     count          avg. time
    seeks       0              N/A
    reads       1              0.0002
    writes      5              0.0001
    kaio_reads  0              N/A
    kaio_writes 0              N/A

8   tmpdbs2          16384          8           98304          48          16732.7
    op type     count          avg. time
    seeks       0              N/A
    reads       1              0.0000
    writes      5              0.0001
    kaio_reads  0              N/A
    kaio_writes 0              N/A

9   tmpdbs3          16384          8           98304          48          17746.3
    op type     count          avg. time
    seeks       0              N/A
    reads       1              0.0000
    writes      5              0.0001
    kaio_reads  0              N/A
    kaio_writes 0              N/A

10  datadbs1_1       1638400        800         655360         320         1586.5
    op type     count          avg. time
    seeks       0              N/A
    reads       0              N/A
    writes      0              N/A
    kaio_reads  100            0.0004
    kaio_writes 28             0.0015

11  datadbs2_1       98304          48          98304          48          2959.7
    op type     count          avg. time
    seeks       0              N/A
    reads       0              N/A
    writes      0              N/A
    kaio_reads  6              0.0003
    kaio_writes 5              0.0004

12  datadbs3_1       98304          48          98304          48          2622.1
    op type     count          avg. time
    seeks       0              N/A
    reads       0              N/A
    writes      0              N/A
    kaio_reads  6              0.0003
    kaio_writes 5              0.0005

13  datadbs4_1       65536          32          49152          24          4823.7
    op type     count          avg. time
    seeks       0              N/A
    reads       0              N/A
    writes      0              N/A
    kaio_reads  4              0.0002
    kaio_writes 3              0.0002

14  datadbs5_1       65536          32          49152          24          2755.5
    op type     count          avg. time
    seeks       0              N/A
    reads       0              N/A
    writes      0              N/A
    kaio_reads  4              0.0005
    kaio_writes 3              0.0002


[gbasedbt@devsvr ~]$ 

—3.28 打印 AIO 全局信息

onstat -g iog
[gbasedbt@devsvr ~]$ onstat -g iog
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 3 days 00:05:01 -- 597864 Kbytes

AIO global info:
   9 aio classes
  15 open files
  64 max global files

[gbasedbt@devsvr ~]$ 

—3.29 打印 I/O 队列信息

onstat -ioq
[gbasedbt@devsvr ~]$ onstat -g ioq
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 1 days 00:17:22 -- 597864 Kbytes

AIO I/O queues:
q name/id    len maxlen totalops  dskread dskwrite  dskcopy
 fifo   0      0      0        0        0        0        0 
drda_dbg   0      0      0        0        0        0        0 
sqli_dbg   0      0      0        0        0        0        0 
  kio   0      0      3      475      399       76        0 
  kio   1      0     16      330       49      281        0 
  kio   2      0      3      174        3      171        0 
  kio   3      0      2       73        2       71        0 
  adt   0      0      0        0        0        0        0 
  msc   0      0      1        7        0        0        0 
  aio   0      0      5      128       17        0        0 
  pio   0      0      0        0        0        0        0 
  lio   0      0      0        0        0        0        0 
  gfd   3      0      0        0        0        0        0 
  gfd   4      0      0        0        0        0        0 
  gfd   5      0      0        0        0        0        0 
  gfd   6      0      0        0        0        0        0 
  gfd   7      0      4        7        1        6        0 
  gfd   8      0      4        7        1        6        0 
  gfd   9      0      4        7        1        6        0 
  gfd  10      0      0        0        0        0        0 
  gfd  11      0      0        0        0        0        0 
  gfd  12      0      0        0        0        0        0 
  gfd  13      0      0        0        0        0        0 
  gfd  14      0      0        0        0        0        0 

[gbasedbt@devsvr ~]$ 

q name/id

—3.30 打印 AIO VP 统计信息

onstat -g iov
[gbasedbt@devsvr ~]$ onstat -g iov
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 1 days 00:19:07 -- 597864 Kbytes

AIO I/O vps:
class/vp/id s  io/s totalops  dskread dskwrite  dskcopy  wakeups  io/wup  errors tempops 
 fifo  7  0 i   0.0        0        0        0        0        1   0.0       0        0 
  kio -1  0 i   0.0      474      399       75        0      944   0.5       0        0 
  kio -1  1 i   0.0      318       49      269        0      595   0.5       0        0 
  kio -1  2 i   0.0      173        3      170        0      345   0.5       0        0 
  kio -1  3 i   0.0       73        2       71        0      146   0.5       0        0 
  msc  6  0 i   0.0        7        0        0        0        8   0.9       0        7 
  aio  5  0 i   0.0      133       20        6        0      135   1.0       0        0 
  aio  9  1 i   0.0        8        0        7        0        2   4.0       0        0 
  aio 10  2 i   0.0        1        0        0        0        2   0.5       0        0 
  aio 11  3 i   0.0        1        0        0        0        2   0.5       0        0 
  aio 12  4 i   0.0        3        0        2        0        2   1.5       0        0 
  aio 13  5 i   0.0        0        0        0        0        2   0.0       0        0 
  pio  4  0 i   0.0        0        0        0        0        1   0.0       0        0 
  lio  3  0 i   0.0        0        0        0        0        1   0.0       0        0 

[gbasedbt@devsvr ~]$ 

—3.31 打印池内存统计信息

onstat -g mem
[gbasedbt@devsvr ~]$ onstat -g mem
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 3 days 00:27:57 -- 597864 Kbytes

Pool Summary:
name         class addr             totalsize        freesize         #allocfrag #freefrag 
aqtpool      V     47daf040         8192             1168             6          2         
afpool       V     46578040         4096             808              1          1         
tpcpool      V     47d70040         12288            3232             7          3         
seqpool      V     47da3040         4096             736              2          1         
pnlpool      V     47d73040         8192             1680             4          2         
sbtlist      V     46e41040         20480            7200             4          3         
dstpool      V     47d6f040         8192             3728             2          2         
tenprp_cach  V     47fd2040         8192             4008             8          1         
ampool       V     47d9c040         4096             304              7          1         
srvnm_cache  V     47d5e040         8192             3920             9          1         
main_loop()  V     47f95040         679936           22808            112        40        
sb_delundoq  V     46e78040         49152            8752             4          3         
XTF_mem      V     47e13040         724992           5008             4          3         
bf_prioswee  V     487ce040         28672            3056             13         4         
pmpool       V     47d74040         8192             3728             2          2         
memory       V     494e5040         28672            3056             13         4         
GridQuery    V     47257040         4096             736              2          1         
readahead_0  V     4878a040         49152            4312             35         5         
userlbacpoo  V     47d78040         8192             3728             2          2         
ritem        V     46fea040         8192             2608             8          2         
onlinereorg  V     47fa7040         20480            1720             4          3         
onmode_mon   V     487f0040         32768            3576             20         3         
lgflushpool  V     486ce040         4096             504              3          1         
2            V     47fe7040         16384            2672             17         2         
rsam         V     46f1c040         1069056          10808            1170       4         
sqcrypto_na  V     4725c040         4096             464              2          1         
sscpool0     V     47d65040         12288            1584             2          2         
aslogflush   V     486cf040         28672            3056             13         4         
aio          V     47253040         2043904          67808            569        86        
opcinstpool  V     47d72040         8192             2704             3          2         
dbausrpool   V     47daa040         8192             3312             13         2         
smartblob    V     46e40040         16384            6504             7          2         
gls          V     47d61040         1327104          3936             6197       7         
policypool   V     47d77040         8192             3728             2          2         
DefConvWrit  V     47e0f040         16384            2776             102        1         
proxyWrite   V     46e34040         49152            2832             2          2         
sysprocpool  V     47dab040         8192             2512             8          2         
resroutpool  V     47d76040         8192             3728             2          2         
periodic     V     494e3040         28672            3056             13         4         
btscanner_0  V     48172040         49152            3168             36         5         
auto_tune    V     487ac040         49152            6736             29         5         
smx          V     47d44040         8192             3392             11         2         
sb_delq      V     46e46040         49152            8752             4          3         
resident     R     440d8040         37343232         19912            10         9         
dictpool     V     47d66040         110592           1280             34         2         
grgid_cache  V     47d50040         8192             3920             9          1         
mt           V     46579040         10776576         52048            5933       124       
env_vars     V     46558040         61440            2944             341        1         
31           V     4a42b040         73728            9664             78         7         
24           V     487f5040         20480            5152             23         4         
hstad_cache  V     47d55040         16384            136              133        1         
44           V     4a32d040         16384            2672             17         2         
aggpool      V     47d75040         8192             3728             2          2         
procpool     V     47d6c040         20480            2168             25         3         
extdpool     V     47da5040         8192             1992             8          2         
global       V     46557040         16007168         842120           4501       611       
Shard        V     47259040         12288            4768             3          2         
spnam_cache  V     47d4d040         8192             2776             21         1         
compr_cache  V     47255040         8192             4008             8          1         
ctcpool      V     47d71040         12288            3728             6          3         
tmxapool     V     47da9040         4096             680              3          1         
sb_arcspace  V     46f16040         8192             1752             4          2         
pwnam_cache  V     47d47040         12288            2744             41         3         
sb_loheader  V     46eab040         282624           6528             413        57        
RSS          V     47fb6040         188416           3536             507        43        
inhpool      V     47d9e040         8192             1536             37         1         
pwuid_cache  V     47d4b040         8192             2776             21         1         
opcpool      V     47d9d040         8192             3272             18         1         
hstnm_cache  V     47d52040         8192             3568             13         1         

Blkpool Summary:
name         class addr             size             #blks     
mt           V     4657b860         4169728          58        
global       V     46575e00         0                0         

[gbasedbt@devsvr ~]$ 

Pool Summary

Blkpool Summary

—3.32 打印网络用户统计信息

onstat -g ntu
[gbasedbt@devsvr ~]$ onstat -g ntu
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 16:26:22 -- 597864 Kbytes

global network information:
  #netscb connects         read        write    q-free  q-limits  q-exceed alloc/max
   5/   8       33        85258        85270    3/   4  240/  10    0/   0    6/   6

Individual thread network information (basic):
          netscb type   thread name    sid   fd poll    reads   writes q-nrm q-pvt q-exp
        4a1d4c90 soctcp sqlexec         54    2    5        6        6  0/ 1  1/ 1  0/ 0
        47b75290 soctcp sqlexec         52    8    5       19       19  0/ 1  1/ 1  0/ 0
        47b5ba40 soctcp sqlexec         25    3    5       11       11  0/ 1  1/ 1  0/ 0
        47b51b90 soctcp soctcplst        3    1    5       33        0  0/ 0  0/ 0  0/ 0
        47b4dbe0 soctcp soctcppoll       2    0    5    85260        0  0/ 0  0/ 0  0/ 0


[gbasedbt@devsvr ~]$ 

—3.33 打印网络用户时间

[gbasedbt@devsvr ~]$ onstat -g ntt
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 15:55:48 -- 597864 Kbytes

global network information:
  #netscb connects         read        write    q-free  q-limits  q-exceed alloc/max
   5/   8       33        85258        85270    3/   4  240/  10    0/   0    6/   6

Individual thread network information (times):
          netscb thread name    sid     open     read    write address                  
        4a1d4c90 sqlexec         54 08:26:03 08:26:06 08:26:06                          
        47b75290 sqlexec         52 08:04:07 08:06:36 08:06:36                          
        47b5ba40 sqlexec         25 18:39:14 18:39:21 18:39:21                          
                              06/18/21 06/18/21 06/18/21
        47b51b90 soctcplst        3 17:37:38 08:51:32          192.168.3.8|9088|soctcp  
                              06/18/21                  
        47b4dbe0 soctcppoll       2 18:39:14                                            
                              06/18/21                  


[gbasedbt@devsvr ~]$ 

—3.34 显示打开的分区(表和索引)

onstat -g opn
[gbasedbt@devsvr ~]$ onstat -g opn
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 1 days 00:43:00 -- 597864 Kbytes
rstcb 0x470ef268 tid 51
isfd  op_mode    op_flags   partnum    ucnt ocnt lk ra   partp          ocnt ucnt
0     0x70000    0x403      0x800090   1    0       0    0x4a38c088     0    1   

rstcb 0x470f1568 tid 174
isfd  op_mode    op_flags   partnum    ucnt ocnt lk ra   partp          ocnt ucnt
0     0x2        0x117      0x800048   2    2    IX 0    0x494e75b0     1    1   
1     0x400      0x313      0x800048   2    2    IX 0    0x494e75b0     1    1   


[gbasedbt@devsvr ~]$ 

—3.35 打印 VP 信息

onstat -g sch
[gbasedbt@devsvr ~]$ onstat -g sch
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 3 days 00:58:07 -- 597864 Kbytes

VP Scheduler Statistics:
 vp    pid       class       semops    busy waits  spins/wait  bsy lspins
 1     26606     cpu         69        69          10001       0         
 2     26631     adm         0         0           0           0         
 3     26632     lio         2         0           0           0         
 4     26637     pio         2         0           0           0         
 5     26643     aio         160       0           0           0         
 6     26644     msc         11        0           0           0         
 7     26650     fifo        2         0           0           0         
 8     26656     cpu         266389    266787      9990        0         
 9     26667     aio         4         0           0           0         
 10    26672     aio         4         0           0           0         
 11    26673     aio         4         0           0           0         
 12    26674     aio         4         0           0           0         
 13    26675     aio         3         0           0           0         
 14    39853     cpu         262888    263233      9990        0         
 15    39854     cpu         262410    262600      9995        0         

Thread Migration Statistics:
 vp    pid       class      steal-at steal-sc idlvp-at idlvp-sc inl-polls Q-ln
 1     26606     cpu        1491341  424864   370      52       76120     0   
 2     26631     adm        0        0        9194907  766179   0         0   
 3     26632     lio        0        0        0        0        0         0   
 4     26637     pio        0        0        0        0        0         0   
 5     26643     aio        0        0        1        1        0         0   
 6     26644     msc        0        0        0        0        0         0   
 7     26650     fifo       0        0        0        0        0         0   
 8     26656     cpu        2643732  2509801  854      150      0         0   
 9     26667     aio        0        0        1        1        0         0   
 10    26672     aio        0        0        1        1        0         0   
 11    26673     aio        0        0        1        1        0         0   
 12    26674     aio        0        0        2        2        0         0   
 13    26675     aio        0        0        0        0        0         0   
 14    39853     cpu        2528843  2399366  422      52       0         0   
 15    39854     cpu        1495999  1409886  221      23       0         0   


[gbasedbt@devsvr ~]$ 

—3.36 打印共享内存段的统计信息

显示当前有哪些内存段,及每个内存段的使用情况。

onstat -g seg
[gbasedbt@devsvr ~]$ onstat -g seg
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 16:23:20 -- 597864 Kbytes

Segment Summary:
id         key        addr             size             ovhd     class blkused  blkfree 
1540101    52ce4801   44000000         38227968         881240   R     9333     0       
1572870    52ce4802   46475000         78643200         923208   V     10997    8203    
1605639    52ce4803   4af75000         80166912         1        B     19572    0       
1638408    52ce4804   4fbe9000         415174656        1        B     101361   0       
Total:     -          -                612212736        -        -     141263   8203    

   (* segment locked in memory)
No reserve memory is allocated

[gbasedbt@devsvr ~]$ 

—3.37 打印与会话有关的信息

打印Session连接信息。

onstat -g ses [session_id]
[gbasedbt@devsvr ~]$ onstat -g ses
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 16:11:04 -- 597864 Kbytes

session                                      #RSAM    total      used       dynamic 
id       user     tty      pid      hostname threads  memory     memory     explain 
56       gbasedbt -        0        -        0        16384      13712      off 
54       gbasedbt 4        22403    192.168. 1        73728      65560      off 
52       gbasedbt 4        18186    devsvr   1        114688     107624     off 
25       gbasedbt 3        40077    devsvr   1        90112      69168      off 
3        gbasedbt -        0        -        0        16384      15360      off 
2        gbasedbt -        0        -        0        16384      13712      off 

[gbasedbt@devsvr ~]$ 

指定SessionID,可以显示更详细的信息。

[gbasedbt@devsvr ~]$ onstat -g ses 54
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 16:13:38 -- 597864 Kbytes

session           effective                            #RSAM    total      used       dynamic 
id       user     user      tty      pid      hostname threads  memory     memory     explain 
54       gbasedbt -         4        22403    192.168. 1        73728      65560      off 

Program :
/opt/gbase/bin/dbaccess

tid      name     rstcb            flags    curstk   status
198      sqlexec  470f1568         Y--P---  3984     cond wait  netnorm   -

Memory pools    count 1
name         class addr              totalsize  freesize   #allocfrag #freefrag 
54           V     4a1f4040         73728      8168       80         5         

name           free       used           name           free       used      
overhead       0          3288           scb            0          144       
opentable      0          3824           filetable      0          528       
log            0          16536          temprec        0          2216      
ralloc         0          1024           gentcb         0          1616      
ostcb          0          2968           sqscb          0          21880     
sql            0          72             hashfiletab    0          552       
osenv          0          2768           sqtcb          0          7808      
fragman        0          336            

sqscb info
scb              sqscb            optofc   pdqpriority optcompind  directives
47b87290         4968c028         0        0           2           1         

Sess       SQL            Current            Iso Lock       SQL  ISAM F.E. 
Id         Stmt type      Database           Lvl Mode       ERR  ERR  Vers  Explain    
54         -              mydb2              LC  Not Wait   0    0    9.24  Off        

Last parsed SQL statement :
  Database 'mydb2@gbaseserver'

[gbasedbt@devsvr ~]$ 

—3.38 打印 sbspace 信息

onstat -g smb [c | s] [e | h] [cad | fdd | lod]

[gbasedbt@devsvr ~]$ onstat -g smb c
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 3 days 01:18:58 -- 597864 Kbytes

Chunk Summary:

sbnum 4    chunk 4   
    Chunk: address          flags    offset   size     orig fr  usr pgs  free pg
                   4861a028 FR------ 0        51200    47678    47678    47678   
           path: /opt/gbase/gbaseserver_dbs/sbspace1

           start pg npages 
    Ud1  : 53       23839   
    Md   : 23892    3469    
    Ud2  : 27361    23839   


[gbasedbt@devsvr ~]$ 

—3.39 打印与 SQL 有关的会话信息

onstat -g sql <Session_ID>
[gbasedbt@devsvr ~]$ onstat -g sql 52
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 16:19:40 -- 597864 Kbytes


Sess       SQL            Current            Iso Lock       SQL  ISAM F.E. 
Id         Stmt type      Database           Lvl Mode       ERR  ERR  Vers  Explain    
52         SELECT         mydb               LC  Not Wait   0    0    9.24  Off        

Current statement name : slctcur

Current SQL statement (4) :
  select * from t_user

Last parsed SQL statement :
  select * from t_user

[gbasedbt@devsvr ~]$ 

隔离级别

—3.40 打印线程概要文件

语法

onstat -g tpf <thread_id>

示例

[gbasedbt@devsvr ~]$ onstat -g tpf 174
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 1 days 01:09:31 -- 597864 Kbytes

Thread profiles
tid lkreqs lkw dl to lgrs isrd iswr isrw isdl isct isrb lx bfr bfw lsus lsmx seq
174 3829   0   0  0  121  1605 14   0    4    2    1    0  4173 161 0    8284 10 

[gbasedbt@devsvr ~]$ 

—3.41 打印等待队列线程队列

onstat -g wai
[gbasedbt@devsvr ~]$ onstat -g wai
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 3 days 01:28:05 -- 597864 Kbytes

Waiting threads:
 tid     tcb              rstcb            prty status                vp-class       name
 2        47ed0c88         0                1    IO Idle                 3lio*        lio vp 0
 3        47ef1368         0                1    IO Idle                 4pio*        pio vp 0
 4        47f12368         0                1    IO Idle                 5aio*        aio vp 0
 5        47f33368         20e1f00          1    IO Idle                 6msc*        msc vp 0
 6        47f64368         0                1    IO Idle                 7fifo*       fifo vp 0
 7        47f8cd30         470dc028         3    sleeping secs: 1        8cpu         main_loop()
 10       48173748         470dc8e8         1    sleeping secs: 1        8cpu         flush_sub(0)
 11       48173a88         470dd1a8         1    sleeping secs: 1        8cpu         flush_sub(1)
 12       481aa028         470dda68         1    sleeping secs: 1        8cpu         flush_sub(2)
 13       481aa368         470de328         1    sleeping secs: 1        8cpu         flush_sub(3)
......
 38       4848d6a8         470ebde8         1    sleeping secs: 1        8cpu         flush_sub(28)
 39       4848da38         470ec6a8         1    sleeping secs: 1        8cpu         flush_sub(29)
 40       484fa028         470ecf68         1    sleeping secs: 1        8cpu         flush_sub(30)
 41       484fa3b8         470ed828         1    sleeping secs: 1        8cpu         flush_sub(31)
 42       484fa748         0                3    IO Idle                 1cpu*        kaio
 43       484faad8         0                3    IO Idle                 8cpu*        kaio
 44       48616d48         0                1    IO Idle                 9aio*        aio vp 1
 45       48649368         0                1    IO Idle                10aio*        aio vp 2
 46       4866a368         0                1    IO Idle                11aio*        aio vp 3
 47       4868b368         0                1    IO Idle                12aio*        aio vp 4
 48       486ac368         0                1    IO Idle                13aio*        aio vp 5
 49       486cd758         470ee0e8         2    sleeping secs: 1        8cpu         aslogflush
 51       4868bce0         470ef268         3    cond wait  ReadAhead   15cpu         readahead_0
 52       486316c8         470efb28         3    sleeping secs: 1        8cpu         auto_tune
 155      494bcbc8         470f0ca8         3    sleeping secs: 1        1cpu*        onmode_mon
 156      487fc7f0         470f1e28         3    sleeping secs: 1        8cpu         periodic
 157      487fcc70         470f26e8         3    sleeping forever        1cpu         memory
 166      4a305028         470f03e8         1    cond wait  bp_cond      8cpu         bf_priosweep()
 170      4a21dbe0         0                3    IO Idle                14cpu*        kaio
 171      494c8368         0                2    sleeping forever        8cpu*        soctcplst
 173      4a433860         0                3    IO Idle                15cpu*        kaio
 189      49b32028         470f1568         1    yield time             14cpu         btscanner_0
 191      49d15370         470ee9a8         1    cond wait  netnorm      1cpu         sqlexec


[gbasedbt@devsvr ~]$ 

—3.42  打印线程的等待统计信息

onstat -g wst
[gbasedbt@devsvr ~]$ onstat -g wst
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 3 days 01:31:44 -- 597864 Kbytes
name     tid  state            n        avg(us)  max(us) 

btscanne 189  IO Wait          1               1         1 
btscanne 189  yield 0          19              4        12 
btscanne 189  yield time       372          88.0s    180.3s
btscanne 189  other mutex      26              4        30 
btscanne 189  ready            1147           21      2724 
btscanne 189  run              419           229      3868 
btscanne 189  IO Idle          1               2         2 

sqlexec  191  IO Wait          1             801       801 
sqlexec  191  other cond       4             112       143 
sqlexec  191  ready            6              10        57 
sqlexec  191  run              5             147       307 

[gbasedbt@devsvr ~]$ 

state说明

 

赞(0)
MySQL学习笔记 » 第13章:GBase 8s 管理员常用命令