GBase 8s 管理员常用命令

28 篇文章 47 订阅
26 篇文章 26 订阅

GBase 8s 管理员常用命令

oninit

命令说明
oninit -i初始化根 dbspace 的磁盘空间
oninit启动数据库到在线模式下
oninit -j启动数据库到单用户模式下
oninit -s启动数据库到静态模式下

启动数据库到在线模式

启动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 ~]$ 

启动数据库到单用户模式

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

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 ~]$ 

启动数据库到静态模式

当管理员希望做一些非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 ~]$ 


onmode

命令说明
onmode -m将数据库服务器从静态模式或单用户模式,切换为在线模式
onmode -k使数据库服务器处于离线模式,并清除共享内存
onmode -s以优雅地方式关闭数据库服务器,切换到静态模式
onmode -u立即关闭数据库服务器,切换到静态模式
onmode -j使数据库服务器进入单用户方式
onmode -l切换逻辑日志文件
onmode -c强制执行检查点
onmode -r开始共享内存的常驻部分的强制驻留
onmode -n结束共享内存的常驻部分的强制驻留
onmode -p添加或删除虚拟管理器
onmode -P动态地启动、停止或重启监听线程
onmode -wf更新 onconfig 文件中指定配置参数的值
onmode -wm动态设置内存中指定配置参数的值
onmode -z终止数据库服务器会话

切换数据库到在线模式

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

onmode -m

切换数据库到离线模式

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

onmode -k

切换数据库到静态模式

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

onmode -s
onmode -u

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

切换数据库到单用户模式

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

onmode -j

切换逻辑日志文件

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

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 ~]$ 

强制执行检查点

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

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

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

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

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

[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 ~]$ 

添加或删除虚拟管理器

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 ~]$ 

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

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.

> 

更新 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]$ 

终止数据库服务器会话

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
> 


onstat

命令说明
onstat -打印数据库当前运行模式
onstat -c打印onconfig文件内容
onstat -m打印系统在线日志最新信息
onstat -l打印物理日志和逻辑日志使用状态
onstat -d打印数据库空间和Chunk文件使用信息
onstat -D打印数据库空间和Chunk文件读写信息
onstat -t打印表空间信息
onstat -T打印表空间信息
onstat -k打印锁信息
onstat -p打印系统运行状态统计
onstat -r重复运行命令
onstat -u打印用户线程
onstat -x打印事务

打印数据库当前运行模式

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

[gbasedbt@train ~]$ 

打印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 ~]$ 

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

查看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 ~]$ 

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

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

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 ~]$

物理日志标题

标题说明
Buffer是当前的物理日志缓冲区名称
bufused是已使用的物理日志缓冲区页数
bufsize是每个物理日志缓冲区的大小(以页为单位)
numpages是写入物理日志的页数
numwrits是对磁盘的写入数
pages/io计算方法是 numpages/numwrits,该值指示正在缓存的物理日志写入的效率
phybegin是日志开始处的物理页号
physize是物理日志的大小(以页为单位)
phypos是日志中发生下一个日志记录写入的当前数量
phyused是日志中已使用页的数量
%used是已使用页的百分比

逻辑日志标题

标题说明
Buffer逻辑日志缓冲区数
bufused逻辑日志缓冲区呢已使用的页数
bufsize每个逻辑日志缓冲区的大小(以页为单位)
numrecs是已写入记录的数量
numpages是已写入页的数量
numwrits是对逻辑日志的写入数
recs/pages计算方法是 numrecs/numpages
pages/io计算方法是 numpages/numwrits
Subsystem子系统
numrecs记录数
Log Space used逻辑日志空间已使用数
address是日志文件描述符的地址
number是逻辑日志文件的日志标识号
flags提供每个日志的状态
uniqid是日志的唯一 ID 号
begin是日志文件的起始页
size是日志的大小(以页为单位)
used是已使用页数量
%used是已使用页的百分比

flags

标志说明
A新添加的(可以使用)
B已备份
C当前的逻辑日志文件
D标记为已删除。要删除日志文件并释放其空间以再利用,那么必须对所有存储空间执行 0 级备份
F可用的,可以使用
L最新的 checkpoint 记录
U已使用的

打印数据库空间和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 ~]$ 
字段名称
address是共享内存空间表中的存储空间地址
number是创建时指定的存储空间的唯一 ID
flags使用十六进制值描述每个存储空间的属性
fchunk第一个 chunk 的 ID
nchunks存储空间中的 chunk 数
pgsizeDbspace 页的大小 (以字节为单位)
flags使用字母代码描述每个存储空间属性
owner存储空间的所有者
name存储空间的名称
标记值1(flags)描述
0x0001允许镜像且 dbspace 是未镜像的
0x0002允许镜像且 dbspace 是已镜像的
0x0004Dbspace 包含禁用镜像的 chunk
0x0008新镜像的
0x0010Blobspace
0x0200正在恢复空间
0x0400空间已物理恢复
0x0800正在恢复逻辑日志
0x2000临时 dbspace
0x4000正在备份 blobspace
0x8000Sbspace
0x10000物理或逻辑日志已更改
0x20000Dbspace 或 chunk 表已更改
0x040000包含大 chunk 的 blobspace
0x080000在此 dbspace 中的 chunk 已重命名
0x00100000仅供共享磁盘辅助服务器使用的临时 dbspace 。它是在 SD 辅助服务器中列出 SDS_TEMPDBS 配置参数的其中之一的 sbspace
0x00200000SD 辅助服务器的临时 dbspace 。在共享磁盘辅助服务器上列出了 DBSPACETEMP 配置参数
0x00400000该 dbspace 已被外部备份
0x00800000Dbspace 正在进行碎片整理
0x01000000Plogspace

标记值2(flags)

位置1位置2位置3位置4位置5
M:已镜像X:新镜像的B:BlobspaceB:具有大于2GB的大chunkA:Dbspace 是自动扩展的
N:未镜像P:物理恢复的,正在等待逻辑恢复P:Plogspace
L:正在进行逻辑恢复S:Sbspace
R:正在进行恢复T:临时 dbspace
D:关闭U:临时 sbspace
W:主服务器上的临时 dbspace

Chunks字段信息

字段名称
addressChunk 的地址
chunk/dbsChunk 编号和相关联的空间编号
offset页中文件或原始设备的偏移量
size以 chunk 所属的 dbspace 页面大小为单位表示的 chunk 的大小
free以 chunk 所属的 dbspace 页面大小为单位表示的 chunk 的可用页数量
bpages是 blobpage 中 chunk 的大小
flagschunk 状态信息
pathname物理设备的路径名

chunk 状态信息标志说明

位置1位置2位置3位置4位置5位置6
P:主N:已重命名-:DbspaceB:有大于2GB的chunk-:chunk不可扩展-:不启用直接 I/O 选项 或并发 I/O 选项
M:镜像O:联机B:BlobspaceE:chunk可扩展C:启用并发 I/O 选项
D:关闭S:SbspaceD:启用直接 I/O 选项
X:新镜像
I:不一致

打印数据库空间和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 ~]$
字段说明
addressChunk 的地址
chunk/dbsChunk 编号和相关联的空间编号
offset页中文件或原始设备的偏移量
page Rd已读取页数量
page Wr已写入页的数量
pathname物理设备的路径名

打印表空间信息

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

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 ~]$ 

字段说明
n是打开的 tblspace 的计数器
address是共享内存 tblspace 表中的 tblspace 地址
flgs标志位
ucnt使用计数,它指示当前正在访问 tblspace 的用户线程数
tblnum是以十六进制值表示的 tblspace 编号,等价的整数值显示为 systables 系统目录表中的 partnum 值
physaddr是 tblspace 的物理地址(在磁盘上)
npages是分配给 tblspace 的页数
nused是 tblspace 中已使用页的数量
npdata是已使用数据页的数量
nrows是已使用数据行的数量
nextns是已分配非连续 extent 的数量

显示全部表空间的表空间信息。

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 ~]$ 

字段说明
n是打开的 tblspace 的计数器
address是共享内存 tblspace 表中的 tblspace 地址
flgs标志位
ucnt使用计数,它指示当前正在访问 tblspace 的用户线程数
tblnum是以十六进制值表示的 tblspace 编号,等价的整数值显示为 systables 系统目录表中的 partnum 值
physaddr是 tblspace 的物理地址(在磁盘上)
npages是分配给 tblspace 的页数
nused是 tblspace 中已使用页的数量
npdata是已使用数据页的数量
nrows是已使用数据行的数量
nextns是已分配非连续 extent 的数量

打印锁信息

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 ~]$ 
字段说明
address锁表中锁的地址。如果用户线程正在等待该锁,那么锁的地址出现在 onstat -u (用户)输出的 wait 字段中。
wtlist正在等待锁的用户线程(如果有)列表中的第一项
owner正持有锁的线程的共享内存地址。此地址对应于 onstat -u (用户)输出的 address 字段中的地址。当 owner 值显示在括号中时,它代表事务结构的共享内存地址。只有锁是为全局事务而分配时,才会出现这种情况。该地址对应于 onstat -G 的输出的地址字段
lklist是刚才列出的所有者所持有的链接列表中的下一个锁
type锁的类型代码
tblsnum是锁定资源的 tblspace 编号。如果数值小于 10000,那么它表示 Enterprise Replication 伪锁
rowid是行标识号
key#/bsiz是索引键号或对于 VARCHAR 锁的已锁定字节数
标志说明
HDR
B字节
S共享
X互斥
I意向
U更新
IX意向—互斥
IS意向—共享
SIX共享,意向—互斥

打印系统运行状态统计

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

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 ~]$ 
参数说明
dskreads实际的磁盘读取数
pagreads页读取数
bufreads共享内存读取数
%cached对磁盘的物理写入的实际数量
pagwrits已写入页的数量
bufwrits共享内存写入数
%cached缓冲池中已高速缓存的写入数百分比
isamtot调用总数
open当 tblspace 打开时增加
start增加索引中的指针
read当调用读取函数时增加
write当每次写调用时增加
rewrite当发生更新时增加
delete当删除行时增加
commit每次执行 iscommit() 调用时增加
rollbk当事务回滚时增加
gp_read一般页读取数
gp_write一般页写入数
gp_rewrt一般页更新数
gp_del一般页删除数
gp_alloc一般页分配数
gp_free已释放并返回给 tablspace 的一般页数
gp_curs用于一般页的游标数
ovlock会话尝试超过锁最大数量的次数
ovuserthread用户尝试超过用户线程最大数量的次数
ovbuff数据库服务器无法找到可用共享内存缓冲区的次数。当没有可用缓冲区时,数据库服务器将 dirty 缓冲区写入磁盘,然后设法找到可用缓冲区
usercpu所有用户线程使用的用户 CPU 时间(以秒为单位),该条目每 15 秒更新一次
syscpu所有用户线程使用的全部系统 CPU 时间(以秒为单位),该条目每 15 秒更新一次
numckpts自引导时间以来的 checkpoint 数
flushes缓冲池已清仓到磁盘的次数
bufwaits每次用户线程必须等待缓冲区时增加
lokwaits每次用户线程必须等待锁时增加
lockreqs每次请求锁时增加
deadlks每次检测到潜在死锁并阻止时增加
dltouts每次用户线程等待锁时已超过分布式死锁超时时增加
ckpwaitsCheckpoint 等待数
compress每次压缩数据页时增加
seqscans对每个顺序扫描增加
ixda-RA索引页到数据页的预先读取计数
idx-RA遍历索引页的预先读取计数
da-RA仅数据路径扫描的计数
logrec-RA数据库服务器预先读取的日志记录
RA-pgsused数据库服务器预先读取所使用的页数
lchwaits存储线程需要等待共享存储锁存器的次数

重复运行命令

可以使用-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

打印用户线程

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 ~]$ 

字段说明
address在用户表中用户线程的共享内存地址
flags提供会话状态
sessid会话标识用来标识每个唯一的会话
user用户登录名(从操作系统派生)
tty用户正在使用的标准错误(stderr)文件名称(从操作系统派生)
wait如果用户线程正在等待特定锁存器、锁、互斥锁或条件,该字段显示该资源的地址
tout当前等待中的剩余秒数
locks用户线程正持有的锁数
nreads用户线程已执行的磁盘读取数
nwrites用户线程已执行的写调用数

flags说明

位置1位置2位置3位置4位置5位置6位置7
B:正在等待缓冲区*:I/O 故障过程中的事务是活动的A:Dbspace 备份线程P:会话主线程R:正在读取R:恢复过程中使用的线程B:B-tree 清除程序线程
C:正在等待 checkpointX:临界段中的线程-:恢复过程中未使用的线程C:已终止正在等待清除的用户线程
G:正在等待对逻辑日志缓冲区的写入D:守护程序线程
L:正在等待锁F:页清除程序线程
S:正在等待互斥
T:正在等待事务
Y:正在等待条件
X:正在等待事务清除(回滚)

打印事务

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 ~]$ 

字段说明
address事务结构的共享内存地址
flags标志位
userthread拥有事务的线程(rstcb 地址)
locks事务持有的锁数
begin_logposBEGIN WORK 记录已记录到其中的日志
current logpos事务最近写入日志的当前日志位置
isol隔离级别
est. rb_time服务器回滚该事务所需的估计时间
retrys启动分布式查询的恢复线程的尝试次数
coord从属者正在执行事务时事务协调者的名称

flags标志说明

位置1位置2位置3位置4位置5
A:用户线程已连接到事务T:紧耦合方式(MTS)B:开始工作X:XA 事务G:全局事务
S:TP/XA 暂挂的事务L:松耦合方式(缺省方式)P:准备好用于提交的分布式查询C:分布式查询协调者
C:TP/XA 正在等待回滚X:准备好用于提交的 TP/XAS:分布式查询从属者
C:正在提交或已提交B:分布式查询协调者和从属者
R:正在回滚或已回滚M:重新定向的全局事务
H:正在尝试回滚或已回滚

命令说明
onstat -g osi打印操作系统的信息
onstat -g env打印环境变量值
onstat -g cfg打印配置参数的当前值
onstat -g ckp打印 checkpoint 历史记录和配置建议
onstat -g arc打印归档状态
onstat -g ath打印所有线程的信息
onstat -g act打印活动线程
onstat -g bth打印阻塞的和正在等待的线程
onstat -g buf打印缓冲池的概要文件信息
onstat -g cpu打印运行时间统计信息
onstat -g dis打印数据库服务器信息
onstat -g dri打印高可用性数据复制信息
onstat -g glo打印全局多线程信息
onstat -g iof打印 异步 I/O 统计信息
onstat -g iog打印 AIO 全局信息
onstat -g iov打印 AIO VP 统计信息
onstat -g ioq打印 I/O 队列信息
onstat -g mem打印池内存统计信息
onstat -g ntd打印网络统计信息
onstat -g ntt打印网络用户的次数
onstat -g opn打印打开的分区
onstat -g seg打印共享内存段的统计信息
onstat -g sch打印 VP 信息
onstat -g sql打印与 SQL 有关的会话信息
onstat -g ses打印与会话有关的信息
onstat -g smb打印 sbspace 信息
onstat -g tpf打印线程概要文件
onstat -g wai打印等待队列线程队列
onstat -g wst打印线程的等待统计信息

打印操作系统的信息

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 ~]$ 

打印环境变量值

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 ~]$ 

打印配置参数的当前值

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 ~]$ 

打印 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 ~]$ 

字段说明
Auto Checkpoints标示 AUTO_CKPTS 配置参数是 on 或 off
RTO_SERVER_RESTART显示 RTO 时间(以秒为单位)。零(0)意味着 RTO 是关闭的
Estimated recovery time ## seconds如果数据服务器停止响应,标示评估恢复时间。该值仅在 RTO_SERVER_RESTART 被激活时出现。
IntervalCheckpoint 间隔 ID
Clock TimeCheckpoint 发生的 Clock 时间
Trigger事件触发 checkpoint 。 星号(*)表示请求的 checkpoint 是事务阻塞的 checkpoint 。
LSNCheckpoint 记录在逻辑日志中的位置
Total Time以秒表示 checkpoint 持续的总时间,从请求开始到 checkpoint 结束
Flush Time以秒表示清除缓冲池的时间
Block Time由于 checkpoint 被稀缺的必需资源触发而导致事务阻塞的时间(以秒表示)。例如:耗尽物理日志或环绕逻辑日志
# Waits由于正在等待 checkpoint 而阻塞的事务的数量
Ckpt Time以秒表示所有事务认识到请求的 checkpoint 的时间
Wait Time以秒表示该事务已等待 checkpoint 的平均时间
Long Time以秒表示事务等待 checkpoint 的最长时间
# Dirty Buffers在 checkpoint 期间,刷新到磁盘的 dirty 缓冲区的数量
Dskflu/sec每秒刷新的缓冲区数
Physical Log Total Pages在 checkpoint 间隔,物理日志记录的总页数
Physical Log Avg/Sec在 checkpoint 间隔,物理日志活动的平均率
Logical Log Total Pages在 checkpoint 间隔,逻辑日志记录的总页数
Logical Log Avg/Sec在 checkpoint 间隔,逻辑日志活动的平均率
Max Plog pages/sec在 checkpoint 间隔,物理日志活动的最大速率
Max Llog pages/sec在 checkpoint 间隔,逻辑日志活动的最大速率
Max Dskflush Time以秒表示缓冲池刷新到磁盘的最长时间
Avg Dskflush pages/sec缓冲池刷新到磁盘的平均速率
Avg Dirty pages/sec在 checkpoint 之间 dirty 页的平均速率
Blocked Time以秒表示自上次数据库服务器启动后最长阻塞时间

打印归档状态

语法

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 ~]$ 

说明

描述
numDbspace 编号
DBSpaceDbspace 名称
Q Size前映象队列大小。该信息主要为了 GBase 支持
Q Len前映象队列长度。该信息主要为了 GBase 支持
Buffer前映象缓冲区使用的页数
partnum前映象 bin 分区号
size前映象 bin 的页数
scanner
描述
nameDbspace 名
numberDbspace 编号
level归档级别
date最后一次归档的日期和时间
log用来启动归档的 checkpoint 的唯一ID (UNIQID)
log-position用来启动归档的 checkpoint 的日志位置(LOGPOS)

打印所有线程的信息

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 ~]$ 

描述
tid线程 ID
tcb线程控制 block 访问地址
rstcbRSAM 线程控制 block 访问地址
prty线程优先级
status线程状态
vp-class虚拟处理器类
name线程名称。对于参与并行存储优化操作的线程,它表示操作的名称和线程编号

打印活动线程

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 ~]$ 

描述
tid线程 ID
tcb线程控制 block 访问地址
rstcbRSAM 线程控制 block 访问地址
prty线程优先级
status线程状态
vp-class虚拟处理器类
name线程名称。对于参与并行存储优化操作的线程,它表示操作的名称和线程编号

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

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 ~]$
描述
tid线程 ID
name线程名称
blocking resource列出的等待线程的资源类型
blocker列出的阻塞线程的线程 ID

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

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 ~]$ 

字段说明
Buffer pool page size缓冲池中页面的字节数
dskreads将页面带入缓冲池的已执行你的磁盘读操作数。每次读操作读取一个或多个页面。
pagreads从磁盘读入缓冲池的页面数
bufreads从该缓冲池读取的页面内存映象次数
%cached为满足高速缓存页面映象的该缓冲池读取的页面百分比(而不是执行磁盘读取)。计算为 (bufreads - dskreads) / bufreads x 100。更高的百分比说明有更好的高速缓存性能。
dskwrits将更改的页面从缓冲池写回磁盘所执行的磁盘写入操作数。每次写入操作撰写一个或多个页面。
pagwrits从缓冲池写入磁盘的页面数
bufwrits写入该缓冲池的页面内存映象次数
%cached为满足高速缓存页面映象的该缓冲池写入的页面百分比(而不是执行磁盘写入)。计算为 (bufwrits - dskwrits) / bufwrits x 100 。
bufwrits_sinceckpt自上个 checkpiont 后页面内存映象写入该缓冲池的次数
bufwaits在该缓冲池内线程必须等待缓冲区内锁的次数。数字越大说明在相同页面上互不兼容的锁的多个线程之间的争用越多。
ovbuff为了创建空闲的缓冲区来读取另外一个受请求的页面而将更改了的缓冲区从该缓冲池写入磁盘的次数。如果 ovbuff 值很大,那么可能说明缓冲池还不够大,还不能容纳使用该缓冲池的应用程序所需的工作集,这可能导致性能降级。
flushes服务器为缓冲池内所有 dirty 缓冲区执行的大清空的次数。这可能由不同的原因引起,可能是作为 checkpoint 过程的一部分而执行此操作或缓冲池在清洁的缓冲区外运行(无论 LRU 清除活动是否正常)。
Fg Writes该缓冲池中访问缓冲区的非 I/O 清空程序线程写入磁盘的已更改缓冲区的数量。这个数字是 ovbuff 字段的超集。除了 ovbuff 字段计数的写入服务页面缺省值的次数,该值也包括为了保持数据库记录和保留页的一致性而执行的操作所做的前台写,其目的是为了保证正确的恢复。
LRU Writes由 LRU 清除线程从该缓冲池将更改了的缓冲区写入磁盘的数量。如果缓冲池超过了指定在 lru_max_dirty 字段中 BUFFERPOOL 配置参数值或如果由于缓冲池溢出而发生前台写,那么将激活 LRU 清除程序。
Avg. LRU TimeLRU 清除程序用来清除单个 LRU 链所用的平均时间
Chunk Writes由 Chunk 清除操作将已更改的缓冲区写入磁盘的数量。Chunk 清除程序撰写了所有在缓冲池中的某个 chunk 内的已更改的缓冲区。这项操作在需要快速清除大量缓冲区(例如 checkpoint 进程和快速恢复)的各种特殊环境中进行。
Total Mem缓冲池的大小
# extends缓冲池被扩展的次数
max memory (memory setting)缓冲池的目标最大大小。该缓冲池的大小可以超过该值,但是不能多于一个分段的大小。
max extends (buffers setting)缓冲池库被扩展的至多次数。(该字段没有在示例样本中显示)
next memory (memory setting)缓冲池的下一次要扩展的大小
next buffers (buffers setting)为该缓冲池下一次扩展所需的缓冲区数 (该字段没有在示例样本中显示)
cache hit ratio低于该缓冲池被扩展的读缓存的命中率
last上次缓冲池扩展的时间
id缓冲池段的 ID
segment缓冲池段的内部地址
size缓冲池段的大小
# buffs缓冲池段中缓冲区数
Fast Cache Stats快速缓存(减少需要访问缓冲池的时间类型的缓存)的统计信息
gets服务器在快速缓存中寻找缓冲区的次数
hits服务器发现它正在寻找快速缓存缓冲区的次数
%hitshits 的百分比 ,即 hits*100/gets
puts服务器向快速缓存中插入缓冲区的次数

打印运行时间统计信息

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 ~]$ 

字段说明
tid线程 ID
name线程名称
vp正在运行线程的虚拟处理器的 ID
Last Run线程上次运行的时间戳
CPU Time直到现在线程运行的时间
#scheds线程被安排运行的次数
status线程的状态。

打印数据库服务器信息

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 ~]$ 

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

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 ~]$ 

字段说明
Type服务器的当前类型:主服务器、辅助服务器或标准服务器
Stateon 或 off
Paired server与该服务器配对的主服务器或辅助服务器的名称
Last DR CKPT最后 checkpoint ID 和页
Supports Proxy Writes显示该服务器是否配置允许辅助服务器更新。Y = 支持辅助服务器更新,N = 不支持辅助服务器更新
DRINTERVALonconfig 文件中配置参数的值
DRTIMEOUTonconfig 文件中配置参数的值
DRAUTOonconfig 文件中配置参数的值
DRLOSTFOUNDonconfig 文件中配置参数的值
DRIDXAUTOonconfig 文件中配置参数的值
ENCRYPT_HDRonconfig 文件中配置参数的值
Backlog在 HDR 数据复制缓冲区中还未发送到 HRD 辅助服务器中的日志页数
Last Send最后一个消息发送至对等节点的时间
Last Receive从对等节点接收的最后一个消息的时间
Last Ping上次 ping 的时间
Last log page applied(log id,page)上次应用日志的日志 ID 和页

打印全局多线程信息

[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 ~]$ 

虚拟处理器摘要

列名描述
sessions会话数
threads线程总数
vps虚拟处理器的总数
lngspins线程不得不 spin 超过 10,000 次以获得资源上的 latch 的次数
time生成统计信息的时间。服务器启动时开始统计或通过运行 onstat -z 命令重置统计信息。
sched calls排定呼叫的总数
thread switches从一个线程到另一个线程切换的总次数
yield线程收益率的统计信息(在该线程无法继续它的任务直到发生别的条件时发生)

Virtual Processor Summary

列名描述
class虚拟处理器的类型
vps这个虚拟处理器类的实例的数量
usercpu这个虚拟处理器类在 CPU 上运行所花费的总用户时间(秒)
syscpu这个虚拟处理器类在 CPU 上运行所花费的总系统时间(秒)
total虚拟处理器类的总 CPU 时间,它是用户时间加上系统时间的总和

Individual virtual processors

列名描述
vp虚拟处理器编号。在 Windows™ 上,是线程 ID 值。
pidoninit 进程的进程 ID
class虚拟处理器类
usercpu虚拟处理器类在 CPU 上运行的总用户时间(秒)
syscpu虚拟处理器类在 CPU 上运行的总系统时间(秒)
total虚拟处理器类的总 CPU 时间,它是用户时间加上系统时间的总和
Thread线程在虚拟处理器上运行的总时间
Eff效率。总 CPU 时间占线程在虚拟处理器上运行总时间的比率

显示异步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 ~]$ 

字段说明
gfd该 chunk 或文件的全局文件描述符编号
pathnameChunk 或文件的路径名
bytes read已经对 chunk 或文件执行的读取的字节数
page reads已经对 chunk 或文件执行的页读取数
bytes write已经对 chunk 或文件执行写入的字节数
page writes已经对 chunk 或文件执行的页写入数
io/s每妙执行的 I/O 操作数,该值代表 chunk 或文件的 I/O 性能
op type操作类型
count此操作发生的次数
avg time操作结束所花的平均时间

打印 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 ~]$ 

打印 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/idI/O 队列的名称和编号。
len在队列中暂挂 I/O 请求的数量
maxlen队列中同时存在的 I/O 请求的最大数量
totalops队列中已经完成的 I/O 操作的总数
dskread队列已完成的读操作的总数
dskwrite队列已完成的写操作的总数
dskcopy队列已完成的复制操作的总数

q name/id

说明
sqli_dbg处理 GBase 技术支持的 SQL 接口调试功能的 I/O
fifo处理 FIFO VPs 的 I/O
adt处理审计 I/O
msc处理杂项 I/O
aio处理 GBase 8s 异步 I/O
kio处理内核 AIO
pio处理物理日志记录 I/O
lio处理逻辑日志记录 I/O
gfd全局文件描述符 - 为每个主 chunk 和镜像 chunk 分配单独的全局文件描述符。

打印 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 ~]$ 

字段说明
class虚拟处理器类
vp虚拟处理器在类中的 ID 编号
sAIO 虚拟处理器的当前状态
io/s自数据库服务器启动以来或自 onstat -z 上次运行以来虚拟处理器的平均 I/O 速度(以每秒操作数衡量)
totalops自数据库服务器启动以来或自 onstat -z 上次运行以来虚拟处理器执行的 I/O 操作总数(以每秒操作数衡量)
dskread自数据库服务器启动以来或自 onstat -z 上次运行以来虚拟处理器执行的读操作总数(以每秒操作数衡量)
dskwrite自数据库服务器启动以来或自 onstat -z 上次运行以来虚拟处理器执行的写操作总数(以每秒操作数衡量)
dskcopy自数据库服务器启动以来或自 onstat -z 上次运行以来虚拟处理器执行的复制操作总数(以每秒操作数衡量)
wakeups对于 AIO VPs ,是自数据库服务器启动以来或自 onstat -z 上次运行以来虚拟处理器处于空闲状态的次数
io/wup对于 AIO VPs ,是自数据库服务器启动以来或自 onstat -z 上次运行以来该虚拟处理器每次唤醒执行的 I/O 操作平均数
errorsKAIO 超出资源的错误总数
tempops仅供内部使用。是用来确定何时添加新 AIO VP 的 I/O 操作计数。它只在 AUTO_AIOVPS 配置参数启用时应用。

打印池内存统计信息

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

字段说明
name池的名称
addr池内存地址
totalsize池大小,以字节表示
freesize在池中的可用内存量
#allocfrag在池中的已分配的分片
#freefrag在池中的可用分片

Blkpool Summary

字段说明
name池的名称
addr池内存地址
size池大小,以字节表示
#blks池中的 block 数

打印网络用户统计信息

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 ~]$ 

打印网络用户时间


[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 ~]$ 

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

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 ~]$ 
字段说明
tid当前访问分区资源(表和索引)的线程 ID
rstcb该线程的 RSAM 线程控制 block 的内存地址
isfd与打开分区关联的 ISAM 文件描述符
op_mode使用以下十六进制值组合的分区锁定方式的当前状态
op_flags分区的当前状态使用以下十六进制值组合:
partnum已打开资源(表和索引)的分区数
ucnt当前访问该分区的用户线程数
ocnt打开该分区的次数
lk锁类型

打印 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 ~]$ 

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

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

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 ~]$ 
字段说明
id共享内存分段 ID
key与共享内存分段 ID 相关联的共享内存键
addr共享内存分段地址
size共享内存分段大小(字节)
ovhd共享内存分段控制信息(开销)大小(字节)
class共享内存的类型(B 代表共享内存池、V 代表虚拟、VX 代表虚拟扩展、M 代表消息)
blkused已使用内存的 block 数
blkfree空闲内存的 block 数

打印与会话有关的信息

打印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 ~]$ 
字段说明
Session id会话 ID
user启动该会话的用户名
tty与此会话的前端关联的 tty
pid与此会话的前端关联的进程 ID
hostname此会话已连接的主机名
#RSAM threads为此会话分配的 RSAM 线程的数量
total memory为此会话分配的内存量
used memory此会话实际使用的内存量
dynamic explain生成会话的 SQL 语句的说明输出(on 或 off)
字段说明
tid线程 ID
name线程的名称
rstcbRSAM 控制 block
flags使用以下代码描述线程的状态:
curstk当前堆栈大小
status当前线程状态
name池名称
class池所分配位置的内存类。R 代表常驻、V 代表虚拟、M 代表消息
addr池结构的地址
totalsize池获得的内存的总的大小,以字节表示
freesize在池中的可用字节数量
#allocfrag在池中已分配内存分片的数量
#freefrag在池中的可用分片数量
字段说明
name已经从池中分配内存的组件的名称
free释放的字节数量
used分配的字节数量
字段说明
scb会话控制 block。这是共享内存中主会话结构的地址
sqscb会话的 SQL 级别控制 block
optofcOPTOFC 环境变量或 ONCONFIG 配置文件设置的当前值
pdqpriorityPDQPRIORITY 环境变量或 ONCONFIG 配置文件设置的当前值
optcompindOPTCOMPIND 环境变量或 ONCONFIG 配置文件设置的当前值
directivesDIRECTIVES 环境变量或 ONCONFIG 配置文件设置的当前值

打印 sbspace 信息

onstat -g smb [c | s] [e | h] [cad | fdd | lod]
命令解释
onstat -g smb c列出 sbspace 中的所有的 chunk
onstat -g smb e列出所有智能大对象表类型的条目
onstat -g smb e cad列出智能大对象 chunk 头表条目
onstat -g smb e fdd列出智能大对象文件描述符条目
onstat -g smb e lod列出智能大对象头表中的条目
onstat -g smb fdd列出智能大对象文件描述符
onstat -g smb h列出所有智能大对象表类型头
onstat -g smb h cad列出智能大对象 chunk 头表头
onstat -g smb h fdd列出智能大对象文件描述符表头
onstat -g smb h lod列出智能大对象文头表的表头
onstat -g smb lod列出在智能大对象头表中的头和条目
onstat -g smb s列出 sbspace 属性(所有者、名称、页大小、-Df 标识设置)
[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 ~]$ 

打印与 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 ~]$ 
字段说明
Sess id会话标识
SQL Stmt typeSQL 语句类型
Current Database会话的当前数据库的名称
ISO Lvl隔离级别
Lock mode当前会话的锁定方式
SQL Error当前语句遇到的 SQL 错误号
ISAM Error当前语句遇到的 ISAM 错误号
F.E. Version当前客户端程序使用的 SQLI 协议的版本
ExplainSET EXPLAIN 设置

隔离级别

字段说明
DRDirty 读取
CR已提交读取
CS游标锁定
DRUDirty 读取,保留更新锁
CRU已提交读取,保留更新锁
CSU游标锁定,保留更新锁
LC已提交读取,最后提交
LCU已提交读取,最后提交,保留更新锁
RR可重复的读取
NL没有事务的数据库

打印线程概要文件

语法

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 ~]$ 

列名说明
tid线程 ID
lkreqs锁请求数
lkw锁等待数
dl死锁数
to远程死锁超时
lgrs日志记录
isrd读取数
iswr写入数
isrw重新写入数
isdl删除数
isct提交数
isrb回滚数
lx长事务
bfr缓冲区读取数
bfw缓冲区写入数
lsus当前使用的日志空间
lsmx使用的最大日志空间
seq顺序扫描数

打印等待队列线程队列

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 ~]$ 

字段说明
tid线程 ID
tcb线程控制 block 的内存地址
rstcbRSAM 线程控制 block 的内存地址
prty线程优先级。较大的数字代表较高的优先级
status线程的当前状态
vp-class上次运行线程的 VP 的虚拟处理器整数 ID 与运行线程的 VP 类的名称连接
name线程名称

打印线程的等待统计信息

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 ~]$ 

字段说明
name线程名称
tid线程 ID
state说明在此输出行内等待的线程。如果单个线程在多个不同的状态中等待,那么它可能有多行输出。
n在此状态下等待的线程次数
avg(us)每次等待发生的时候,线程在此状态下等待的平均用户时间。时间的单位为微秒,值后的 s 表示以秒为单位计算用户时间。
max(us)等待发生的时候,线程在此状态下等待的最大用户时间。时间的单位为微秒,值后的 s 表示以秒为单位计算用户时间。

state说明

说明
chkpt cond线程等待 checkpoint 条件
cp mutex线程等待 checkpoint 互斥可用
deadlock mutex线程等待死锁互斥可用
empty Q线程等待队列中的空缓冲区
fork线程等待子线程运行
full Q线程等待队列上的一个完整的缓冲区
IO IdleI/O 线程空闲
IO Wait线程产生,同时等待 I/O 完成
join wait线程等待另一个线程退出
lock mutex线程等待锁定互斥可用
lockfree mutex线程等待锁释放互斥可用
logflush发生逻辑日志清空
log mutex线程等待逻辑日志互斥可用
logcopy cond线程等待逻辑日志复制互斥可用
logio cond线程等待逻辑日志条件
lrus mutex线程等待缓冲区 LRU 互斥可用
misc现场等待杂项理由
other cond线程等待内部条件
other mutex线程等待内部系统互斥可用
other yield线程等待内部原因
OS read线程等待操作系统读请求完成
OS write线程等待操作系统写请求完成
ready线程已准备好运行
run线程已运行
sort io线程等待排序 I/O 完成
vp mem sync线程等待虚拟处理器同步
yield bufwait线程产生,同时等待缓冲区可用
yield 0线程产生,但立即超时
yield time线程产生超时
yield forever线程产生并保持这种方式,直到它被唤醒
  • 7
    点赞
  • 56
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值