GBase 8s 管理员命令(新版本)

28 篇文章 46 订阅
26 篇文章 26 订阅

GBase 8s 管理员命令

gserver

命令说明
gserver init初始化根 dbspace 的磁盘空间
gserver start启动数据库到在线模式下
gserver stop停止数据库
gserver shutdown停止数据库,并清理共享内存

启动数据库到在线模式

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

语法:

gserver start

操作演示

[gbasedbt@devsvr ~]$ gserver start
Your evaluation license will expire on 2022-10-14 00:00:00
Reading configuration file '/opt/gbase/etc/onconfig.gbase8s'...succeeded
Creating /GBASEDBTTMP/.infxdirs...succeeded
Allocating and attaching to shared memory...succeeded
Creating resident pool 11030 kbytes...succeeded
Creating infos file "/opt/gbase/etc/.infos.gbase8s"...succeeded
Linking conf file "/opt/gbase/etc/.conf.gbase8s"...succeeded
Initializing rhead structure...rhlock_t 16384 (512K)... rlock_t (2656K)... Writing to infos file...succeeded
Initialization of Encryption...succeeded
Initializing ASF...succeeded
Initializing Dictionary Cache and SPL Routine Cache...succeeded
Bringing up ADM VP...succeeded
Creating VP classes...succeeded
Forking main_loop thread...succeeded
Initializing DR structures...succeeded
Forking 1 'soctcp' listener threads...succeeded
Starting tracing...succeeded
Initializing 8 flushers...succeeded
Initializing SDS Server network connections...succeeded
Initializing log/checkpoint information...succeeded
Initializing dbspaces...succeeded
Opening primary chunks...succeeded
Validating chunks...succeeded
Initialize Async Log Flusher...succeeded
Starting B-tree Scanner...succeeded
Init ReadAhead Daemon...succeeded
Init DB Util Daemon...succeeded
Initializing DBSPACETEMP list...succeeded
Init Auto Tuning Daemon...succeeded
Checking database partition index...succeeded
Initializing dataskip structure...succeeded
Checking for temporary tables to drop...succeeded
Updating Global Row Counter...succeeded
Forking gadmin_mon thread...succeeded
Creating periodic thread...succeeded
Creating periodic thread...succeeded
Starting scheduling system...succeeded
Verbose output complete: mode = 5
[gbasedbt@devsvr ~]$
[gbasedbt@devsvr ~]$ gstat -
Your evaluation license will expire on 2022-06-18 00:00:00
On-Line -- Up 2 days 16:23:56 -- 597864 Kbytes

[gbasedbt@devsvr ~]$ 

停止数据库

停止数据库,数据库进入离线模式。

语法:

gserver stop

操作演示

[gbasedbt@devsvr ~]$ gserver stop
Your evaluation license will expire on 2022-10-14 00:00:00
[gbasedbt@devsvr ~]$ gstat -
Your evaluation license will expire on 2022-10-14 00:00:00
shared memory not initialized for GBASEDBTSERVER 'gbase8s'
[gbasedbt@devsvr ~]$

停止数据库,并清理共享内存

停止数据库,并清理共享内存,数据库进入离线模式。。

语法:

gserver shutdown

操作演示

[gbasedbt@devsvr ~]$ gserver shutdown
Your evaluation license will expire on 2022-10-14 00:00:00
Your evaluation license will expire on 2022-10-14 00:00:00
onclean: Cleaning up processes and resources for 'gbase8s'...
 - Looking for the shmem key: 52574803
 - Looking for the shmem key: 52574804
 - Looking for semaphore ID: 1310720
 - Looking for the shmem key: 52574801
 - Looking for the shmem key: 52574802
 - Looking for the shmem key: 52574805
onclean: GBase Database Server seems to have shutdown cleanly.
[gbasedbt@devsvr ~]$ gstat -
Your evaluation license will expire on 2022-10-14 00:00:00
shared memory not initialized for GBASEDBTSERVER 'gbase8s'
[gbasedbt@devsvr ~]$

gadmin

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

切换数据库到在线模式

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

语法:

gadmin -m

操作演示

[gbasedbt@devsvr ~]$ gstat -
Your evaluation license will expire on 2022-10-14 00:00:00
Single-User -- Up 00:02:05 -- 333720 Kbytes

[gbasedbt@devsvr ~]$ gadmin -m
Your evaluation license will expire on 2022-10-14 00:00:00
[gbasedbt@devsvr ~]$ gstat -
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 00:02:15 -- 333720 Kbytes

[gbasedbt@devsvr ~]$

切换数据库到离线模式

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

语法

gadmin -k

操作演示

[gbasedbt@devsvr ~]$ gstat -
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 00:03:50 -- 333720 Kbytes

[gbasedbt@devsvr ~]$ gadmin -k
Your evaluation license will expire on 2022-10-14 00:00:00

This will take GBase Database Server OFF-LINE -
Do you wish to continue (y/n)? y

There are 0 user threads that will be killed.
Do you wish to continue (y/n)? y
[gbasedbt@devsvr ~]$ gstat -
Your evaluation license will expire on 2022-10-14 00:00:00
shared memory not initialized for GBASEDBTSERVER 'gbase8s'
[gbasedbt@devsvr ~]$

切换数据库到静态模式

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

语法

gadmin -s
gadmin -u

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

操作演示

[gbasedbt@devsvr ~]$ gstat -
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 00:00:17 -- 333720 Kbytes

[gbasedbt@devsvr ~]$ gadmin -s
Your evaluation license will expire on 2022-10-14 00:00:00

This will perform a GRACEFUL SHUTDOWN -
Do you wish to continue (y/n)? y
[gbasedbt@devsvr ~]$ gstat -
Your evaluation license will expire on 2022-10-14 00:00:00
Quiescent -- Up 00:00:44 -- 333720 Kbytes

[gbasedbt@devsvr ~]$

[gbasedbt@devsvr ~]$ gstat -
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 00:01:25 -- 333720 Kbytes

[gbasedbt@devsvr ~]$ gadmin -u
Your evaluation license will expire on 2022-10-14 00:00:00

This will perform an IMMEDIATE SHUTDOWN -
Do you wish to continue (y/n)? y

There are 0 user threads that will be killed.
Do you wish to continue (y/n)? y
[gbasedbt@devsvr ~]$ gstat -
Your evaluation license will expire on 2022-10-14 00:00:00
Quiescent -- Up 00:01:48 -- 333720 Kbytes

[gbasedbt@devsvr ~]$

切换数据库到单用户模式

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

语法

gadmin -j

操作演示

[gbasedbt@devsvr ~]$ gstat -
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 00:03:50 -- 333720 Kbytes

[gbasedbt@devsvr ~]$ gadmin -j
Your evaluation license will expire on 2022-10-14 00:00:00
This will change mode to single user. Only DBSA/gbasedbt can connect
in this mode.
Do you wish to continue (y/n)? y

All threads which are not owned by DBSA/gbasedbt will be killed.
Do you wish to continue (y/n)? y
[gbasedbt@devsvr ~]$ gstat -
Your evaluation license will expire on 2022-10-14 00:00:00
Single-User -- Up 00:04:02 -- 333720 Kbytes

[gbasedbt@devsvr ~]$

切换逻辑日志文件

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

语法

gadmin -l

当前的逻辑日志被标记为C,将逻辑日志切换到下一个后,当前的逻辑日志(uniqid)由8变为9

操作演示

[gbasedbt@devsvr ~]$ gstat -l
Your evaluation license will expire on 2022-10-14 00:00:00
Single-User -- Up 00:04:48 -- 333720 Kbytes

Physical Logging
Buffer bufused  bufsize  numpages   numwrits   pages/io
  P-1  22       1024     16         1          16.00
      phybegin         physize    phypos     phyused    %used
      3:102400         102400     2103       22         0.02

Logical Logging
Buffer bufused  bufsize  numrecs    numpages   numwrits   recs/pages pages/io
  L-3  0        512      215        44         20         4.9        2.2
	Subsystem    numrecs    Log Space used
	OLDRSAM      214        62832
	HA           1          44

address          number   flags    uniqid   begin                size     used    %used
45793f88         4        U-B----  7        2:53                25600       14     0.05
45572f30         5        U---C-L  8        2:25653             25600    18003    70.32
45572f98         6        A------  0        2:51253             25600        0     0.00
45641f30         7        A------  0        2:76853             25600        0     0.00
......
45778188         12       A------  0        2:204853            25600        0     0.00
 9 active, 9 total

[gbasedbt@devsvr ~]$ gadmin -l
Your evaluation license will expire on 2022-10-14 00:00:00
[gbasedbt@devsvr ~]$ gstat -l
Your evaluation license will expire on 2022-10-14 00:00:00
Single-User -- Up 00:05:04 -- 333720 Kbytes

Physical Logging
Buffer bufused  bufsize  numpages   numwrits   pages/io
  P-1  28       1024     16         1          16.00
      phybegin         physize    phypos     phyused    %used
      3:102400         102400     2103       28         0.03

Logical Logging
Buffer bufused  bufsize  numrecs    numpages   numwrits   recs/pages pages/io
  L-3  0        512      361        70         44         5.2        1.6
	Subsystem    numrecs    Log Space used
	OLDRSAM      360        82820
	HA           1          44

address          number   flags    uniqid   begin                size     used    %used
45793f88         4        U-B----  7        2:53                25600       14     0.05
45572f30         5        U-----L  8        2:25653             25600    18004    70.33
45572f98         6        U---C--  9        2:51253             25600        5     0.02
45641f30         7        A------  0        2:76853             25600        0     0.00
......
45778188         12       A------  0        2:204853            25600        0     0.00
 9 active, 9 total

[gbasedbt@devsvr ~]$

强制执行检查点

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

语法

gadmin -c
gadmin -c unblock
gadmin -c block <seconds>

操作演示

[gbasedbt@devsvr ~]$ gadmin -c
Your evaluation license will expire on 2022-10-14 00:00:00
[gbasedbt@devsvr ~]$

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

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

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

语法

gadmin -r

操作演示

[gbasedbt@devsvr ~]$ gadmin -r
Your evaluation license will expire on 2022-10-14 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 ~]$

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

语法

gadmin -n

操作演示

[gbasedbt@devsvr ~]$ gadmin -n
Your evaluation license will expire on 2022-10-14 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可以根据业务运行情况,动态增加和减少虚拟处理器的数量,以适应业务变化,让数据库运行更高效。

语法

gadmin -p +num <vp_class>
gadmin -p -num <vp_class>

操作演示

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

[gbasedbt@devsvr ~]$ gstat -g glo
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 00:30:07 -- 333720 Kbytes

MT global info:
sessions threads  vps      lngspins time
0        42       22       1        1807

          sched calls     thread switches yield 0   yield n   yield forever
total:    42792           31199           11950     25100     1921
per sec:  12              0               12        0         0

Virtual processor summary:
 class       vps       usercpu   syscpu    total
 cpu         1         0.71      0.34      1.05
 aio         15        0.06      0.28      0.34
 lio         1         0.00      0.04      0.04
 pio         1         0.00      0.03      0.03
 adm         1         0.00      0.14      0.14
 soc         1         0.00      0.22      0.22
 msc         1         0.00      0.00      0.00
 fifo        1         0.01      0.01      0.02
 total       22        0.78      1.06      1.84

Individual virtual processors:
 vp    pid       class       usercpu   syscpu    total     Thread    Eff
 1     4251      cpu         0.71      0.34      1.05      2.64      39%
 2     4252      adm         0.00      0.14      0.14      0.00       0%
 3     4253      lio         0.00      0.04      0.04      0.04     100%
 4     4254      pio         0.00      0.03      0.03      0.03     100%
 5     4255      aio         0.00      0.06      0.06      0.10      62%
 6     4256      msc         0.00      0.00      0.00      0.00       0%
 7     4257      fifo        0.01      0.01      0.02      0.02     100%
 8     4258      soc         0.00      0.22      0.22      NA         NA
 9     4259      aio         0.00      0.02      0.02      0.02     100%
 10    4260      aio         0.00      0.02      0.02      0.02     100%
 11    4261      aio         0.00      0.02      0.02      0.02      96%
 12    4262      aio         0.00      0.02      0.02      0.02     100%
 13    4263      aio         0.00      0.02      0.02      0.02     100%
 14    4264      aio         0.00      0.02      0.02      0.02     100%
 15    4265      aio         0.00      0.02      0.02      0.02     100%
 16    4266      aio         0.01      0.01      0.02      0.02     100%
 17    4267      aio         0.01      0.01      0.02      0.02     100%
 18    4268      aio         0.01      0.01      0.02      0.02     100%
 19    4269      aio         0.00      0.02      0.02      0.02     100%
 20    4270      aio         0.01      0.01      0.02      0.02     100%
 21    4271      aio         0.02      0.00      0.02      0.02     100%
 22    4272      aio         0.00      0.02      0.02      0.02     100%
                 tot         0.78      1.06      1.84

[gbasedbt@devsvr ~]$

动态增加5个CPU VP。

[gbasedbt@devsvr ~]$ gadmin -p +5 cpu
Your evaluation license will expire on 2022-10-14 00:00:00
[gbasedbt@devsvr ~]$

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

[gbasedbt@devsvr ~]$ gstat -g glo
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 00:31:51 -- 333720 Kbytes

MT global info:
sessions threads  vps      lngspins time
0        42       27       1        1911

          sched calls     thread switches yield 0   yield n   yield forever
total:    44809           32805           12360     26558     1921
per sec:  0               0               0         0         0

Virtual processor summary:
 class       vps       usercpu   syscpu    total
 cpu         6         0.72      0.34      1.06
 aio         15        0.08      0.28      0.36
 lio         1         0.00      0.04      0.04
 pio         1         0.00      0.03      0.03
 adm         1         0.00      0.15      0.15
 soc         1         0.00      0.23      0.23
 msc         1         0.00      0.00      0.00
 fifo        1         0.01      0.01      0.02
 total       27        0.81      1.08      1.89

Individual virtual processors:
 vp    pid       class       usercpu   syscpu    total     Thread    Eff
 1     4251      cpu         0.72      0.34      1.06      3.15      33%
 2     4252      adm         0.00      0.15      0.15      0.00       0%
 3     4253      lio         0.00      0.04      0.04      0.04     100%
 4     4254      pio         0.00      0.03      0.03      0.03     100%
 5     4255      aio         0.00      0.06      0.06      0.10      62%
 6     4256      msc         0.00      0.00      0.00      0.00       0%
 7     4257      fifo        0.01      0.01      0.02      0.02     100%
 8     4258      soc         0.00      0.23      0.23      NA         NA
 9     4259      aio         0.00      0.02      0.02      0.02     100%
 10    4260      aio         0.00      0.02      0.02      0.02     100%
 11    4261      aio         0.00      0.02      0.02      0.02      96%
 12    4262      aio         0.00      0.02      0.02      0.02     100%
 13    4263      aio         0.00      0.02      0.02      0.02     100%
 14    4264      aio         0.00      0.02      0.02      0.02     100%
 15    4265      aio         0.02      0.02      0.04      0.04     100%
 16    4266      aio         0.01      0.01      0.02      0.02     100%
 17    4267      aio         0.01      0.01      0.02      0.02     100%
 18    4268      aio         0.01      0.01      0.02      0.02     100%
 19    4269      aio         0.00      0.02      0.02      0.02     100%
 20    4270      aio         0.01      0.01      0.02      0.02     100%
 21    4271      aio         0.02      0.00      0.02      0.02     100%
 22    4272      aio         0.00      0.02      0.02      0.02     100%
 23    4449      cpu         0.00      0.00      0.00      0.01       0%
 24    4450      cpu         0.00      0.00      0.00      0.01       0%
 25    4451      cpu         0.00      0.00      0.00      0.00       0%
 26    4452      cpu         0.00      0.00      0.00      0.00       0%
 27    4453      cpu         0.00      0.00      0.00      0.00       0%
                 tot         0.81      1.08      1.89

[gbasedbt@devsvr ~]$

动态减少3个CPU VP。

[gbasedbt@devsvr ~]$ gadmin -p -3 cpu
Your evaluation license will expire on 2022-10-14 00:00:00
[gbasedbt@devsvr ~]$

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

[gbasedbt@devsvr ~]$ gstat -g glo
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 00:32:58 -- 333720 Kbytes

MT global info:
sessions threads  vps      lngspins time
0        42       24       1        1978

          sched calls     thread switches yield 0   yield n   yield forever
total:    46219           33899           12676     27525     1921
per sec:  26              14              12        13        0

Virtual processor summary:
 class       vps       usercpu   syscpu    total
 cpu         3         0.73      0.34      1.07
 aio         15        0.08      0.28      0.36
 lio         1         0.00      0.04      0.04
 pio         1         0.00      0.03      0.03
 adm         1         0.00      0.15      0.15
 soc         1         0.00      0.24      0.24
 msc         1         0.00      0.00      0.00
 fifo        1         0.02      0.01      0.03
 total       24        0.83      1.09      1.92

Individual virtual processors:
 vp    pid       class       usercpu   syscpu    total     Thread    Eff
 1     4251      cpu         0.72      0.34      1.06      3.17      33%
 2     4252      adm         0.00      0.15      0.15      0.00       0%
 3     4253      lio         0.00      0.04      0.04      0.04     100%
 4     4254      pio         0.00      0.03      0.03      0.03     100%
 5     4255      aio         0.00      0.06      0.06      0.10      62%
 6     4256      msc         0.00      0.00      0.00      0.00       0%
 7     4257      fifo        0.02      0.01      0.03      0.03     100%
 8     4258      soc         0.00      0.24      0.24      NA         NA
 9     4259      aio         0.00      0.02      0.02      0.02     100%
 10    4260      aio         0.00      0.02      0.02      0.02     100%
 11    4261      aio         0.00      0.02      0.02      0.02      96%
 12    4262      aio         0.00      0.02      0.02      0.02     100%
 13    4263      aio         0.00      0.02      0.02      0.02     100%
 14    4264      aio         0.00      0.02      0.02      0.02     100%
 15    4265      aio         0.02      0.02      0.04      0.04     100%
 16    4266      aio         0.01      0.01      0.02      0.02     100%
 17    4267      aio         0.01      0.01      0.02      0.02     100%
 18    4268      aio         0.01      0.01      0.02      0.02     100%
 19    4269      aio         0.00      0.02      0.02      0.02     100%
 20    4270      aio         0.01      0.01      0.02      0.02     100%
 21    4271      aio         0.02      0.00      0.02      0.02     100%
 22    4272      aio         0.00      0.02      0.02      0.02     100%
 23    4449      cpu         0.01      0.00      0.01      0.01      71%
 24    4450      cpu         0.00      0.00      0.00      0.01       0%
                 tot         0.83      1.09      1.92

[gbasedbt@devsvr ~]$

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

语法

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

操作演示

停止服务监听。

[gbasedbt@devsvr ~]$ gadmin -P stop gbase8s
Your evaluation license will expire on 2022-10-14 00:00:00
[gbasedbt@devsvr ~]$

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

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

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

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

[gbasedbt@devsvr ~]$ gadmin -P start gbase8s
Your evaluation license will expire on 2022-10-14 00:00:00
[gbasedbt@devsvr ~]$ dbaccess - -
Your evaluation license will expire on 2022-10-14 00:00:00
> database mydb;

Database selected.

>

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

语法

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

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

操作演示

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

[gbasedbt@devsvr ~]$ gstat -c | grep LISTEN_TIMEOUT
Your evaluation license will expire on 2022-10-14 00:00:00
# LISTEN_TIMEOUT             - The number of seconds that GBase
LISTEN_TIMEOUT 60
[gbasedbt@devsvr ~]$ gstat -g cfg | grep LISTEN_TIMEOUT
Your evaluation license will expire on 2022-10-14 00:00:00
LISTEN_TIMEOUT            60
[gbasedbt@devsvr ~]$ gadmin -wm LISTEN_TIMEOUT=50
Your evaluation license will expire on 2022-10-14 00:00:00
Value of LISTEN_TIMEOUT has been changed to 50 seconds.
[gbasedbt@devsvr ~]$ gstat -c | grep LISTEN_TIMEOUT
Your evaluation license will expire on 2022-10-14 00:00:00
# LISTEN_TIMEOUT             - The number of seconds that GBase
LISTEN_TIMEOUT 60
[gbasedbt@devsvr ~]$ gstat -g cfg | grep LISTEN_TIMEOUT
Your evaluation license will expire on 2022-10-14 00:00:00
LISTEN_TIMEOUT            50
[gbasedbt@devsvr ~]$

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

[gbasedbt@devsvr ~]$ gstat -c | grep TAPEDEV
Your evaluation license will expire on 2022-10-14 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 ~]$ gstat -g cfg | grep TAPEDEV
Your evaluation license will expire on 2022-10-14 00:00:00
TAPEDEV                   /dev/null
LTAPEDEV                  /dev/null
[gbasedbt@devsvr ~]$ gadmin -wf TAPEDEV=/home/gbasedbt/backup
Your evaluation license will expire on 2022-10-14 00:00:00
Value of TAPEDEV has been changed to /home/gbasedbt/backup.
[gbasedbt@devsvr ~]$ gstat -c | grep TAPEDEV
Your evaluation license will expire on 2022-10-14 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 ~]$ gstat -g cfg | grep TAPEDEV
Your evaluation license will expire on 2022-10-14 00:00:00
TAPEDEV                   /home/gbasedbt/backup
LTAPEDEV                  /dev/null
[gbasedbt@devsvr ~]$

终止数据库服务器会话

语法

gadmin -z <session_id>

操作演示

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

Database selected.

> !gstat -g ses
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 00:00:58 -- 333720 Kbytes

session                                      #RSAM    total      used       dynamic
id       user     tty      pid      hostname threads  memory     memory     explain
28       gbasedbt -        0        -        0        16384      13712      off
27       gbasedbt -        0        -        1        401408     373408     off
26       gbasedbt -        0        -        1        176128     162680     off
25       gbasedbt -        0        -        1        659456     481144     off
24       gbasedbt -        0        -        1        102400     85464      off
4        gbasedbt 7        4560     devsvr   1        106496     83592      off
3        gbasedbt -        0        -        0        20480      15328      off
2        gbasedbt -        0        -        0        16384      13712      off

> select * from t_dept;


   f_deptid f_deptname

          1 dept_1
          2 dept_2
          3 dept_3

3 row(s) retrieved.

> !gadmin -z 4
Your evaluation license will expire on 2022-10-14 00:00:00
> select * from t_dept;

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

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

> info tables;


Table name



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


gstat

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

打印数据库当前运行模式

语法

gstat -

操作演示

[gbasedbt@devsvr ~]$ gstat -
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 00:03:32 -- 333720 Kbytes

[gbasedbt@devsvr ~]$

打印onconfig文件内容

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

语法

gstat -c

操作演示

[gbasedbt@devsvr ~]$ gstat -c
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 00:04:57 -- 333720 Kbytes

Configuration File: /opt/gbase/etc/onconfig.gbase8s
##################################################################
# Licensed Material - Property Of GBASE 
#
# "Restricted Materials of GBASE"
#
# GBase
# Copyright General Data Corp. 2014, 2015. All rights reserved.
#
# Title: onconfig.std
# Description: GBase Configuration Parameters
#
# Important: $GBASEDBTDIR now resolves to the environment
# variable GBASEDBTDIR. Replace the value of the GBASEDBTDIR  
# environment variable only if the path you want is not under 
# $GBASEDBTDIR.
#
# For additional information on the parameters:
# http://www.gbase.cn
###################################################################

###################################################################
# Root Dbspace Configuration Parameters
###################################################################
# ROOTNAME     - The root dbspace name to contain reserved pages and
#                internal tracking tables.
# ROOTPATH     - The path for the device containing the root dbspace
# ROOTOFFSET   - The offset, in KB, of the root dbspace into the 
#                device. The offset is required for some raw devices. 
# ROOTSIZE     - The size of the root dbspace, in KB.  The value of 
#                200000 allows for a default user space of about 
#                100 MB and the default system space requirements.
# MIRROR       - Enable (1) or disable (0) mirroring
# MIRRORPATH   - The path for the device containing the mirrored 
#                root dbspace
# MIRROROFFSET - The offset, in KB, into the mirrored device 
#
# Warning: Always verify ROOTPATH before performing
#          disk initialization (oninit -i or -iy) to
#          avoid disk corruption of another instance
###################################################################

ROOTNAME rootdbs
ROOTPATH $GBASEDBTDIR/gbase8s_dbs/rootdbs.dbf
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,lru_max_dirty=60.5
BUFFERPOOL      size=2K,buffers=50000,lrus=8,lru_min_dirty=50,lru_max_dirty=60 
BUFFERPOOL      size=16K        

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

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

语法

gstat -m

操作演示

[gbasedbt@devsvr ~]$ gstat -m
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 00:27:02 -- 333720 Kbytes

Message Log File: /opt/gbase/tmp/online.log
02:41:44  Loading Module <SPLNULL>
02:41:44  Auto Registration is synced
02:41:44  SCHAPI: Started 2 dbWorker threads.
02:41:47  Defragmenter cleaner thread now running
02:41:47  Defragmenter cleaner thread cleaned:0 partitions
02:42:44  Loading Module <$GBASEDBTDIR/extend/ifxmngr/ifxmngr.bld>
02:42:44  The C Language Module </opt/gbase/extend/ifxmngr/ifxmngr.bld> loaded
02:43:22  sid 4 username gbasedbt@devsvr pid 4560 terminated by onmode.
02:47:11  Checkpoint Completed:  duration was 0 seconds.
02:47:11  Mon Oct 18 - loguniq 10, logpos 0x6c018, timestamp: 0x889bb Interval: 150

02:47:11  Maximum server connections 1
02:47:11  Checkpoint Statistics - Avg. Txn Block Time 0.000, # Txns blocked 0, Plog used 26, Llog used 33

02:57:12  Checkpoint Completed:  duration was 0 seconds.
02:57:12  Mon Oct 18 - loguniq 10, logpos 0x6e018, timestamp: 0x889ca Interval: 151

02:57:12  Maximum server connections 1
02:57:12  Checkpoint Statistics - Avg. Txn Block Time 0.000, # Txns blocked 0, Plog used 17, Llog used 2


[gbasedbt@devsvr ~]$

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

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

语法

gstat -l

操作演示

[gbasedbt@devsvr ~]$ gstat -l
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 00:28:09 -- 333720 Kbytes

Physical Logging
Buffer bufused  bufsize  numpages   numwrits   pages/io
  P-1  0        1024     59         4          14.75
      phybegin         physize    phypos     phyused    %used
      3:102400         102400     2324       0          0.00

Logical Logging
Buffer bufused  bufsize  numrecs    numpages   numwrits   recs/pages pages/io
  L-2  0        512      197        37         28         5.3        1.3
	Subsystem    numrecs    Log Space used
	OLDRSAM      194        38432
	HA           3          132

address          number   flags    uniqid   begin                size     used    %used
45793f88         4        U-B----  7        2:53                25600       14     0.05
45572f30         5        U-B----  8        2:25653             25600    18004    70.33
45572f98         6        U-B----  9        2:51253             25600       12     0.05
45641f30         7        U---C-L  10       2:76853             25600      112     0.44
45641f98         8        A------  0        2:102453            25600        0     0.00
45778050         9        A------  0        2:128053            25600        0     0.00
457780b8         10       A------  0        2:153653            25600        0     0.00
45778120         11       A------  0        2:179253            25600        0     0.00
45778188         12       A------  0        2:204853            25600        0     0.00
 9 active, 9 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文件使用信息

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

语法

gstat -d

操作演示

[gbasedbt@devsvr ~]$ gstat -d
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 00:31:11 -- 333720 Kbytes

Dbspaces
address          number   flags      fchunk   nchunks  pgsize   flags    owner    name
45641028         1        0x40001    1        1        2048     N  BA    gbasedbt rootdbs
45778280         2        0x40001    2        1        2048     N  BA    gbasedbt llogdbs
457784b0         3        0x1040001  3        1        2048     N PBA    gbasedbt plogdbs
457786e0         4        0x42001    4        1        16384    N TBA    gbasedbt tempdbs1
45778910         5        0x42001    5        1        16384    N TBA    gbasedbt tempdbs2
45778b40         6        0x42001    6        1        16384    N TBA    gbasedbt tempdbs3
45778d70         7        0x40011    7        2        32768    N BBA    gbasedbt binspaces
46ac0028         8        0x48001    9        2        2048     N SBA    gbasedbt sbspaces
46ac0258         9        0x40001    11       1        2048     N  BA    gbasedbt datadbs1
46ac0488         10       0x40001    12       1        2048     N  BA    gbasedbt datadbs2
46ac06b8         11       0x40001    13       1        2048     N  BA    gbasedbt datadbs3
46ac08e8         12       0x40001    14       1        2048     N  BA    gbasedbt datadbs4
46ac0b18         13       0x40001    15       1        2048     N  BA    gbasedbt datadbs5
 13 active, 2047 maximum

Note: For BLOB chunks, the number of free pages shown is out of date.
      Run 'onstat -d update' for current stats.

Chunks
address          chunk/dbs     offset     size       free       bpages     flags pathname
45641258         1      1      0          102400     90940                 PO-B-- /opt/gbase/gbase8s_dbs/rootdbs.dbf
46ac2028         2      2      0          256000     25547                 PO-B-- /opt/gbase/gbase8s_dbs/llogdbs.dbf
46ac3028         3      3      0          204800     102347                PO-BE- /opt/gbase/gbase8s_dbs/plogdbs.dbf
46ac4028         4      4      0          32000      31947                 PO-B-- /opt/gbase/gbase8s_dbs/tempdbs1.dbf
46ac5028         5      5      0          32000      31947                 PO-B-- /opt/gbase/gbase8s_dbs/tempdbs2.dbf
46ac6028         6      6      0          32000      31947                 PO-B-- /opt/gbase/gbase8s_dbs/tempdbs3.dbf
46ac7028         7      7      0          51200     ~3200       3200       POBB-- /opt/gbase/gbase8s_dbs/binspaces_1.dbf
46ac8028         8      7      0          51200     ~3200       3200       POBB-- /opt/gbase/gbase8s_dbs/binspaces_2.dbf
46ac9028         9      8      0          51200      47678      47678      POSB-- /opt/gbase/gbase8s_dbs/sbspaces_1.dbf
                                 Metadata 3469       1700       3469
46aca028         10     8      0          51200      47725      47725      POSB-- /opt/gbase/gbase8s_dbs/sbspaces_2.dbf
                                 Metadata 3472       3472       3472
46acb028         11     9      0          102400     99009                 PO-B-- /opt/gbase/gbase8s_dbs/datadbs1_1.dbf
46acc028         12     10     0          102400     102347                PO-B-- /opt/gbase/gbase8s_dbs/datadbs2_1.dbf
46acd028         13     11     0          102400     102347                PO-B-- /opt/gbase/gbase8s_dbs/datadbs3_1.dbf
46ace028         14     12     0          102400     102347                PO-B-- /opt/gbase/gbase8s_dbs/datadbs4_1.dbf
46acf028         15     13     0          102400     102347                PO-B-- /opt/gbase/gbase8s_dbs/datadbs5_1.dbf
 15 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情况等信息。

语法

gstat -D

操作演示

[gbasedbt@devsvr ~]$ gstat -D
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 00:33:06 -- 333720 Kbytes

Dbspaces
address          number   flags      fchunk   nchunks  pgsize   flags    owner    name
45641028         1        0x40001    1        1        2048     N  BA    gbasedbt rootdbs
45778280         2        0x40001    2        1        2048     N  BA    gbasedbt llogdbs
457784b0         3        0x1040001  3        1        2048     N PBA    gbasedbt plogdbs
457786e0         4        0x42001    4        1        16384    N TBA    gbasedbt tempdbs1
45778910         5        0x42001    5        1        16384    N TBA    gbasedbt tempdbs2
45778b40         6        0x42001    6        1        16384    N TBA    gbasedbt tempdbs3
45778d70         7        0x40011    7        2        32768    N BBA    gbasedbt binspaces
46ac0028         8        0x48001    9        2        2048     N SBA    gbasedbt sbspaces
46ac0258         9        0x40001    11       1        2048     N  BA    gbasedbt datadbs1
46ac0488         10       0x40001    12       1        2048     N  BA    gbasedbt datadbs2
46ac06b8         11       0x40001    13       1        2048     N  BA    gbasedbt datadbs3
46ac08e8         12       0x40001    14       1        2048     N  BA    gbasedbt datadbs4
46ac0b18         13       0x40001    15       1        2048     N  BA    gbasedbt datadbs5
 13 active, 2047 maximum

Chunks
address          chunk/dbs     offset     page Rd  page Wr  pathname
45641258         1      1      0          1151     74       /opt/gbase/gbase8s_dbs/rootdbs.dbf
46ac2028         2      2      0          514      40       /opt/gbase/gbase8s_dbs/llogdbs.dbf
46ac3028         3      3      0          23       67       /opt/gbase/gbase8s_dbs/plogdbs.dbf
46ac4028         4      4      0          24       88       /opt/gbase/gbase8s_dbs/tempdbs1.dbf
46ac5028         5      5      0          24       88       /opt/gbase/gbase8s_dbs/tempdbs2.dbf
46ac6028         6      6      0          24       72       /opt/gbase/gbase8s_dbs/tempdbs3.dbf
46ac7028         7      7      0          0        0        /opt/gbase/gbase8s_dbs/binspaces_1.dbf
46ac8028         8      7      0          0        0        /opt/gbase/gbase8s_dbs/binspaces_2.dbf
46ac9028         9      8      0          15       1        /opt/gbase/gbase8s_dbs/sbspaces_1.dbf
46aca028         10     8      0          1        0        /opt/gbase/gbase8s_dbs/sbspaces_2.dbf
46acb028         11     9      0          387      1        /opt/gbase/gbase8s_dbs/datadbs1_1.dbf
46acc028         12     10     0          2        1        /opt/gbase/gbase8s_dbs/datadbs2_1.dbf
46acd028         13     11     0          2        1        /opt/gbase/gbase8s_dbs/datadbs3_1.dbf
46ace028         14     12     0          2        1        /opt/gbase/gbase8s_dbs/datadbs4_1.dbf
46acf028         15     13     0          2        1        /opt/gbase/gbase8s_dbs/datadbs5_1.dbf
 15 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物理设备的路径名

打印表空间信息

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

语法

gstat -t

操作演示

[gbasedbt@devsvr ~]$ gstat -t
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 00:33:59 -- 333720 Kbytes

Tblspaces
 n address          flgs ucnt tblnum   physaddr         npages nused  npdata nrows  nextns
 4 5790f028         0    1    100001   1:14             600    423    0      413    4
 6 57915880         0    2    100004   1:17             64     50     25     275    4
 7 5799b910         0    1    100005   1:18             168    132    78     3086   3
 8 57983028         0    1    100006   1:19             128    91     55     214    2
 9 5799b028         0    1    100007   1:20             64     38     13     298    2
10 57969908         0    1    100008   1:21             32     17     7      162    3
11 5798e8f8         0    1    100009   1:22             32     22     18     120    3
12 5799c1d0         0    1    10000a   1:23             8      3      1      2      1
15 57984028         0    1    100013   1:32             256    186    135    653    6
22 57996ac8         0    1    10001c   1:41             32     25     1      1      3
29 57dd2028         0    5    100086   1:147            32     21     12     126    3
30 578de9b0         0    1    100087   1:148            64     44     27     1067   2
31 578e3028         0    1    100088   1:149            64     58     45     181    1
32 578de028         0    1    100089   1:150            32     27     8      176    2
33 578df028         0    1    10008a   1:151            16     9      3      60     2
34 579568a8         0    1    10008b   1:152            8      7      4      25     1
35 57dd2a28         0    1    10008c   1:153            8      3      1      3      1
36 57da4b30         0    1    100090   1:157            16     10     4      63     2
39 57daa9d0         0    1    100093   1:160            32     27     22     148    3
41 57de1a48         0    1    100095   1:162            256    218    157    752    6
46 578fa028         0    1    10009b   1:168            8      5      1      4      1
49 578fb028         0    1    10009e   1:171            32     19     14     60     3
60 57986950         0    7    1000d1   1:222            32     19     17     47     3
61 57a735b0         0    3    1000d3   1:224            4      2      0      0      1
62 579a8028         0    1    1000d4   1:225            4      4      0      0      1
63 578e8780         0    2    1000d5   1:226            4      2      0      0      1
64 57a73028         0    2    1000d6   1:227            8      7      6      211    1
65 57adb028         0    2    1000d7   1:228            4      4      0      0      1
66 57af47f0         0    2    1000d8   1:229            8      5      0      0      2
67 57a847f0         0    3    1000d9   1:230            8      6      0      0      2
70 579268b8         0    1    1000ea   1:247            8      2      1      25     1
71 57956028         0    1    1000eb   1:248            8      2      0      0      1
72 57bd7548         0    1    100118   1:43584          16     11     10     411    2
74 5790f6e8         0    1    200001   2:4              50     2      0      0      1
75 57910028         0    1    300001   3:4              50     2      0      0      1
76 579108c8         2    1    400001   4:32             50     3      0      0      1
77 57911028         2    1    500001   5:32             50     3      0      0      1
78 57911908         2    1    600001   6:32             50     3      0      0      1
79 57912028         0    1    800001   9:4              50     8      0      6      1
81 57918028         0    1    800003   9:6              4      3      2      2      1
86 579199c0         0    1    900001   11:4             100    75     0      73     2
87 57adb6c8         0    1    900002   11:5             16     15     8      82     2
88 57bb5a40         0    1    900003   11:6             32     26     15     590    1
91 57b32028         0    1    900008   11:11            8      3      1      1      1
94 57b35028         0    1    900011   11:20            256    181    131    633    6
108 57be6a30         0    1    900049   11:572           8      2      1      3      1
109 5791a028         0    1    a00001   12:4             50     2      0      0      1
110 5791a778         0    1    b00001   13:4             50     2      0      0      1
111 5791b028         0    1    c00001   14:4             50     2      0      0      1
112 5791b778         0    1    d00001   15:4             50     2      0      0      1
 50 active, 112 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 的数量

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

语法

gstat -T

操作演示

[gbasedbt@devsvr ~]$ gstat -T
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 00:40:36 -- 333720 Kbytes

Tblspaces
 n address          flgs ucnt tblnum   physaddr         npages nused  npdata nrows  nextns
 1 57bd7050         8    0    6        0:0              0      0      0      0      0     
 2 57914a10         8    0    f        0:0              0      0      0      0      0     
 3 57bb5050         8    0    59       0:0              0      0      0      0      0     
 4 5790f028         0    1    100001   1:14             600    423    0      413    4     
 5 57915028         0    0    100002   1:15             4      3      1      5      1     
 6 57915880         0    2    100004   1:17             64     50     25     275    4     
 7 5799b910         0    1    100005   1:18             168    132    78     3086   3     
 8 57983028         0    1    100006   1:19             128    91     55     214    2     
 9 5799b028         0    1    100007   1:20             64     38     13     298    2     
10 57969908         0    1    100008   1:21             32     17     7      162    3     
11 5798e8f8         0    1    100009   1:22             32     22     18     120    3     
12 5799c1d0         0    1    10000a   1:23             8      3      1      2      1     
13 57995240         0    0    10000e   1:27             8      4      0      0      1     
14 5795c028         0    0    100011   1:30             8      7      5      33     1     
15 57984028         0    1    100013   1:32             256    186    135    653    6     
16 57986028         0    0    100014   1:33             768    764    683    4781   9     
17 57987770         0    0    100015   1:34             128    121    62     416    5     
18 57969028         0    0    100017   1:36             8      3      1      7      1     
19 57957930         0    0    100018   1:37             8      3      0      0      1     
20 57996028         0    0    100019   1:38             8      4      0      0      1     
......
100 57be5148         0    0    90001a   11:29            8      2      0      0      1     
101 57a4f520         0    0    90001c   11:31            8      8      2      27     1     
102 57be7028         0    0    90001f   11:34            8      3      0      0      1     
103 57bbeac0         0    0    900022   11:37            32     32     19     390    1     
104 578659e8         0    0    90002e   11:49            8      3      0      0      1     
105 57be6028         0    0    90002f   11:50            8      4      0      0      1     
106 57b32840         0    0    900031   11:52            8      3      0      0      1     
107 57be32c8         0    0    900046   11:569           8      3      0      0      1     
108 57be6a30         0    1    900049   11:572           8      2      1      3      1     
109 5791a028         0    1    a00001   12:4             50     2      0      0      1     
110 5791a778         0    1    b00001   13:4             50     2      0      0      1     
111 5791b028         0    1    c00001   14:4             50     2      0      0      1     
112 5791b778         0    1    d00001   15:4             50     2      0      0      1     
 50 active, 112 total


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

打印锁信息

语法

gstat -k

操作演示

[gbasedbt@devsvr ~]$ gstat -k
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 00:43:43 -- 333720 Kbytes

Locks
address          wtlist           owner            lklist           type     tblsnum  rowid    key#/bsiz
441ab028         0                4573cf28           0                HDR+S    100002   204         0
441ab2d0         0                4573bda8           0                    S    100002   204         0
441ab358         0                4573bda8           441ab2d0         HDR+S    100002   201         0
441ab3e0         0                4573c668           0                    S    100002   204         0
441ab468         0                4573d7e8           0                    S    100002   204         0
441ab4f0         0                457391e8           441ab578         HDR+IX   900047   0           0
441ab578         0                457391e8           0                HDR+S    100002   205         0
441ab600         0                457391e8           441ab4f0         HDR+X    900047   100         0
 8 active, 20000 total, 16384 hash buckets, 0 lock table overflows

[gbasedbt@devsvr ~]$
字段说明
address锁表中锁的地址。如果用户线程正在等待该锁,那么锁的地址出现在 gstat -u (用户)输出的 wait 字段中。
wtlist正在等待锁的用户线程(如果有)列表中的第一项
owner正持有锁的线程的共享内存地址。此地址对应于 gstat -u (用户)输出的 address 字段中的地址。当 owner 值显示在括号中时,它代表事务结构的共享内存地址。只有锁是为全局事务而分配时,才会出现这种情况。该地址对应于 gstat -G 的输出的地址字段
lklist是刚才列出的所有者所持有的链接列表中的下一个锁
type锁的类型代码。
tblsnum是锁定资源的 tblspace 编号。如果数值小于 10000,那么它表示 Enterprise Replication 伪锁
rowid如果为0,是表锁。如果以两个0结尾,是页锁。如果是6位数字或不以0结尾的6位以下的数字,是行锁。
key#/bsiz是索引键号或对于 VARCHAR 锁的已锁定字节数

锁类型:

标志说明
HDR
B字节
S共享
X互斥
I意向
U更新
IX意向—互斥
IS意向—共享
SIX共享,意向—互斥

打印系统运行状态统计

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

语法

gstat -p

操作演示

[gbasedbt@devsvr ~]$ gstat -p
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 01:00:27 -- 333720 Kbytes

Profile
dskreads   pagreads   bufreads   %cached dskwrits   pagwrits   bufwrits   %cached
1231       2260       21474      94.27   238        673        1493       84.06

isamtot    open       start      read       write      rewrite    delete     commit     rollbk
16627      1174       2043       5370       617        87         1          48         0

gp_read    gp_write   gp_rewrt   gp_del     gp_alloc   gp_free    gp_curs
3          0          0          0          0          0          4

ovlock     ovuserthread ovbuff     usercpu  syscpu   numckpts   flushes
0          0            0          1.47     1.79     6          12

bufwaits   lokwaits   lockreqs   deadlks    dltouts    ckpwaits   compress   seqscans
38         0          7064       0          0          0          16         392

ixda-RA    idx-RA     da-RA      logrec-RA  RA-pgsused lchwaits
0          662        12         2          153        9

[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参数,每隔指定秒数,执行一次命令。

语法

gstat -r <seconds>

操作演示

[gbasedbt@devsvr ~]$ gstat -r 2
Your evaluation license will expire on 2022-10-14 00:00:00
Single-User -- Up 01:05:45 -- 333720 Kbytes

Single-User -- Up 01:05:47 -- 333720 Kbytes

Single-User -- Up 01:05:49 -- 333720 Kbytes

Single-User -- Up 01:05:51 -- 333720 Kbytes

Single-User -- Up 01:05:53 -- 333720 Kbytes

On-Line -- Up 01:05:55 -- 333720 Kbytes

On-Line -- Up 01:05:57 -- 333720 Kbytes

......

打印用户线程

语法

gstat -u

操作演示

[gbasedbt@devsvr ~]$ gstat -u
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 01:07:40 -- 333720 Kbytes

Userthreads
address          flags   sessid   user     tty      wait             tout locks nreads   nwrites
45732028         ---P--D 1        gbasedbt -        0                0    0     143      166
457328e8         ---P--F 0        gbasedbt -        0                0    0     0        229
457331a8         ---P--F 0        gbasedbt -        0                0    0     0        132
45733a68         ---P--F 0        gbasedbt -        0                0    0     0        73
45734328         ---P--F 0        gbasedbt -        0                0    0     0        1
45734be8         ---P--F 0        gbasedbt -        0                0    0     0        1
457354a8         ---P--F 0        gbasedbt -        0                0    0     0        1
45735d68         ---P--F 0        gbasedbt -        0                0    0     0        1
45736628         ---P--F 0        gbasedbt -        0                0    0     0        1
45736ee8         ---P--- 5        gbasedbt -        0                0    0     0        0
457377a8         ---P--B 6        gbasedbt -        0                0    0     0        0
45738068         Y--P--D 7        gbasedbt -        46b11c88         0    0     544      0
45738928         ---P--D 8        gbasedbt -        0                0    0     0        0
457391e8         Y-BP--- 32       gbasedbt 0        468f3aa8         0    3     0        0
45739aa8         ---P--D 12       gbasedbt -        0                0    0     0        0
4573a368         Y--P--D 31       gbasedbt -        4411dc40         0    0     0        0
4573ac28         ---P--D 13       gbasedbt -        0                0    0     2        0
4573b4e8         ---P--D 14       gbasedbt -        0                0    0     0        0
4573bda8         ---P--- 25       gbasedbt -        0                0    2     306      24
4573c668         ---P--- 26       gbasedbt -        0                0    1     81       18
4573cf28         ---P--- 24       gbasedbt -        0                0    1     9        0
4573d7e8         ---P--- 27       gbasedbt -        0                0    1     128      37
 22 active, 128 total, 26 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:正在等待事务清除(回滚)

打印事务

语法

gstat -x

操作演示

[gbasedbt@devsvr ~]$ gstat -x
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 01:09:08 -- 333720 Kbytes

Transactions
                                                                                           est.
address          flags userthread       locks  begin_logpos      current logpos    isol    rb_time  retrys coord
45779028         A---- 45732028         0      -                 -                 COMMIT  -        0
45779378         A---- 457328e8         0      -                 -                 COMMIT  -        0
457796c8         A---- 457331a8         0      -                 -                 COMMIT  -        0
45779a18         A---- 45733a68         0      -                 -                 COMMIT  -        0
45779d68         A---- 45734328         0      -                 -                 COMMIT  -        0
4577a0b8         A---- 45734be8         0      -                 -                 COMMIT  -        0
4577a408         A---- 457354a8         0      -                 -                 COMMIT  -        0
4577a758         A---- 45735d68         0      -                 -                 COMMIT  -        0
4577aaa8         A---- 45736628         0      -                 -                 COMMIT  -        0
4577adf8         A---- 45736ee8         0      -                 -                 COMMIT  -        0
4577b148         A---- 457377a8         0      -                 -                 COMMIT  -        0
4577b498         A---- 45738068         0      -                 -                 DIRTY   -        0
4577b7e8         A---- 45738928         0      -                 -                 COMMIT  -        0
4577bb38         A-B-- 457391e8         3      10:0xa9018        10:0xa909c        COMMIT  00:00:00 0
4577be88         A---- 4573a368         0      -                 -                 COMMIT  -        0
4577c1d8         A---- 45739aa8         0      -                 -                 COMMIT  -        0
4577c528         A---- 4573ac28         0      -                 -                 COMMIT  -        0
4577c878         A---- 4573b4e8         0      -                 -                 COMMIT  -        0
4577cbc8         A---- 4573bda8         2      -                 -                 DIRTY   -        0
4577cf18         A---- 4573bda8         0      -                 -                 NOTRANS -        0
4577d268         A---- 4573cf28         1      -                 -                 COMMIT  -        0
4577d5b8         A---- 4573c668         1      -                 -                 DIRTY   -        0
4577d908         A---- 4573d7e8         1      -                 -                 DIRTY   -        0
4577dc58         A---- 4573d7e8         0      -                 -                 NOTRANS -        0
4577dfa8         A---- 4573c668         0      -                 -                 NOTRANS -        0
 25 active, 128 total, 25 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:正在尝试回滚或已回滚

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

打印操作系统的信息

语法

gstat -g osi

操作演示

[gbasedbt@devsvr ~]$  gstat -g osi
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 01:10:39 -- 333720 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			1642 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 ~]$

打印环境变量值

语法

gstat -g env

操作演示

[gbasedbt@devsvr ~]$ gstat -g env
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 01:11:36 -- 333720 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      gbase8s
GBASEDBTSQLHOSTS    /opt/gbase/etc/sqlhosts.gbase8s
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.gbase8s
PATH                /opt/gbase/bin:/opt/gbase/sbin:/opt/gbase/bin:/usr/local/bi
                     n:/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 ~]$

打印配置参数的当前值

语法

gstat -g cfg [full | diff | tunable | msg] [param_name]

操作演示

[gbasedbt@devsvr ~]$ gstat -g cfg | grep -v "#"
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 01:12:58 -- 333720 Kbytes

Configuration Parameter List

name                      current value
ROOTNAME                  rootdbs
ROOTPATH                  /opt/gbase/gbase8s_dbs/rootdbs.dbf
ROOTOFFSET                0
ROOTSIZE                  204800
MIRROR                    0
MIRRORPATH                /opt/gbase/tmp/demo_on.root_mirror
MIRROROFFSET              0
DBSERVERNAME              gbase8s
DBSERVERALIASES
SERVERNUM                 1
MSGPATH                   /opt/gbase/tmp/online.log
......
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 历史记录和配置建议

语法

gstat -g ckp

操作演示

[gbasedbt@devsvr ~]$ gstat -g ckp
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 01:14:30 -- 333720 Kbytes

AUTO_CKPTS=On   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
149        02:41:42  Startup    10:0x4b0c0        0.0   0.0   0.0   0      0.0   0.0   0.0   27        27      27       1      1        0
150        02:47:11  CKPTINTVL  10:0x6c018        0.0   0.0   0.0   0      0.0   0.0   0.0   61        61      26       0      33       0
151        02:57:12  CKPTINTVL  10:0x6e018        0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       17       0      2        0
152        03:12:12  CKPTINTVL  10:0x70018        0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       7        0      2        0
153        03:27:13  CKPTINTVL  10:0x7209c        0.0   0.0   0.0   0      0.0   0.0   0.0   3         3       9        0      2        0
154        03:37:13  CKPTINTVL  10:0xa4018        0.0   0.0   0.0   0      0.0   0.0   0.0   48        48      33       0      50       0
155        03:42:13  CKPTINTVL  10:0xa6018        0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       19       0      2        0
156        03:52:14  CKPTINTVL  10:0xa90e8        0.0   0.0   0.0   0      0.0   0.0   0.0   1         1       7        0      3        0

Max Plog       Max Llog       Max Dskflush   Avg Dskflush   Avg Dirty      Blocked
pages/sec      pages/sec      Time           pages/sec      pages/sec      Time
200            200            0              16             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以秒表示自上次数据库服务器启动后最长阻塞时间

打印归档状态

语法

gstat -g arc

操作演示

[gbasedbt@devsvr ~]$ gstat -g arc
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 01:15:27 -- 333720 Kbytes


num   DBSpace            Q Size Q Len  Buffer partnum    size     scanner

Dbspaces - Archive Status
name               number level date             log        log-position
rootdbs            1      0     10/17/2021.23:35 8          0x37be018
llogdbs            2      0     10/17/2021.23:35 8          0x37be018
plogdbs            3      0     10/17/2021.23:35 8          0x37be018
binspaces          7      0     10/17/2021.23:35 8          0x37be018
sbspaces           8      0     10/17/2021.23:35 8          0x37be018
datadbs1           9      0     10/17/2021.23:35 8          0x37be018
datadbs2           10     0     10/17/2021.23:35 8          0x37be018
datadbs3           11     0     10/17/2021.23:35 8          0x37be018
datadbs4           12     0     10/17/2021.23:35 8          0x37be018
datadbs5           13     0     10/17/2021.23:35 8          0x37be018

[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)

打印所有线程的信息

语法

gstat -g ath

操作演示

[gbasedbt@devsvr ~]$ gstat -g ath
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 01:17:02 -- 333720 Kbytes

Threads:
 tid     tcb              rstcb            prty status                vp-class       name
 2        4671d148         0                1    IO Idle                 3lio*        lio vp 0
 3        4673e368         0                1    IO Idle                 4pio*        pio vp 0
 4        4675f368         0                1    IO Idle                 5aio*        aio vp 0
 5        46780368         20e1f00          1    IO Idle                 6msc*        msc vp 0
 6        467b1368         0                1    IO Idle                 7fifo*       fifo vp 0
 7        467d2608         45732028         3    sleeping secs: 1        1cpu         main_loop()
 8        4682d808         0                1    running                 8soc*        soctcppoll
 9        4684c808         0                2    sleeping forever        1cpu*        soctcplst
 10       468f02b0         457328e8         1    sleeping secs: 1        1cpu         flush_sub(0)
 11       468f05f0         457331a8         1    sleeping secs: 1        1cpu         flush_sub(1)
 12       468f0930         45733a68         1    sleeping secs: 1        1cpu         flush_sub(2)
 13       468f0c70         45734328         1    sleeping secs: 1        1cpu         flush_sub(3)
 14       468f1028         45734be8         1    sleeping secs: 1        1cpu         flush_sub(4)
 15       468f1368         457354a8         1    sleeping secs: 1        1cpu         flush_sub(5)
 16       468f16a8         45735d68         1    sleeping secs: 1        1cpu         flush_sub(6)
 17       468f19e8         45736628         1    sleeping secs: 1        1cpu         flush_sub(7)
 18       46ac12c8         0                1    IO Idle                 9aio*        aio vp 1
 19       46af0368         0                1    IO Idle                10aio*        aio vp 2
 20       46b11368         0                1    IO Idle                11aio*        aio vp 3
 21       46b32368         0                1    IO Idle                12aio*        aio vp 4
 22       5761f368         0                1    IO Idle                13aio*        aio vp 5
 23       57640368         0                1    IO Idle                14aio*        aio vp 6
 24       57661368         0                1    IO Idle                15aio*        aio vp 7
 25       57682368         0                1    IO Idle                16aio*        aio vp 8
 26       576a3368         0                1    IO Idle                17aio*        aio vp 9
 27       576c46a8         0                1    IO Idle                18aio*        aio vp 11
 28       576c4368         0                1    IO Idle                19aio*        aio vp 10
 29       576c49e8         0                1    IO Idle                20aio*        aio vp 12
 30       576c4d28         0                1    IO Idle                21aio*        aio vp 13
 31       46af0760         0                1    IO Idle                22aio*        aio vp 14
 32       57769758         45736ee8         2    sleeping secs: 1        1cpu         aslogflush
 33       46b118a0         457377a8         1    sleeping secs: 20       1cpu         btscanner_0
 34       5761f750         45738068         3    cond wait  ReadAhead    1cpu         readahead_0
 35       576616a8         45738928         3    sleeping secs: 1        1cpu         auto_tune
 52       57d220e8         45739aa8         3    sleeping secs: 1        1cpu*        onmode_mon
 53       57d22428         4573ac28         3    sleeping secs: 1        1cpu         periodic
 54       57d22768         4573b4e8         3    sleeping forever        1cpu         memory
 64       57de3760         4573cf28         1    sleeping secs: 1        1cpu         dbutil
 65       57dc0760         4573bda8         1    sleeping secs: 147      1cpu         dbScheduler
 66       57880610         4573c668         1    sleeping forever        1cpu         dbWorker1
 67       579c5610         4573d7e8         1    sleeping forever        1cpu         dbWorker2
 71       57c50c60         4573a368         1    cond wait  bp_cond      1cpu         bf_priosweep()
 73       57c005c8         457391e8         1    cond wait  netnorm      1cpu         sqlexec


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

打印活动线程

语法

gstat -g act

操作演示

[gbasedbt@devsvr ~]$ gstat -g act
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 01:17:59 -- 333720 Kbytes

Running threads:
 tid     tcb              rstcb            prty status                vp-class       name
 8        4682d808         0                1    running                 8soc*        soctcppoll


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

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

语法

gstat -g bth
gstat -g BTH

操作演示

[gbasedbt@devsvr ~]$ onstat -g bth
Your evaluation license will expire on 2022-06-09 12:00:00
On-Line -- Up 4 days 11:08:05 -- 833924 Kbytes

This command attempts to identify any blocking threads.

Highest level blocker(s)
 tid      name                 session
 192      sqlexec              26

Threads waiting on resources
 tid      name                 blocking resource              blocker
 74       readahead_0          Condition (ReadAhead)           -
 189      bf_priosweep()       Condition (bp_cond)             -
 191      sqlexec              Condition (netnorm)             -
 193      sqlexec              Lock (0x4506f638)              192

Run 'onstat -g BTH' for more info on blockers.

[gbasedbt@devsvr ~]$
描述
tid线程 ID
name线程名称
blocking resource列出的等待线程的资源类型
blocker列出的阻塞线程的线程 ID

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

语法

gstat -g buf

操作演示

[gbasedbt@devsvr ~]$ gstat -g buf
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 01:20:45 -- 333720 Kbytes

Profile

Buffer pool page size: 2048
dskreads   pagreads   bufreads   %cached dskwrits   pagwrits   bufwrits   %cached
1223       2189       20952      94.16   215        387        893        75.92
bufwrits_sinceckpt  bufwaits   ovbuff     flushes
0                   38         0          9

Fg Writes     LRU Writes    Avg. LRU Time Chunk Writes  Total Mem
0             0             -nan          114           108Mb

Bufferpool Segments
id segment      size     # buffs
0  0x46b35000   108Mb    50001

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

Buffer pool page size: 16384
dskreads   pagreads   bufreads   %cached dskwrits   pagwrits   bufwrits   %cached
9          72         915        99.02   41         328        603        93.20
bufwrits_sinceckpt  bufwaits   ovbuff     flushes
0                   0          0          3

Fg Writes     LRU Writes    Avg. LRU Time Chunk Writes  Total Mem
0             0             -nan          41            158Mb

Bufferpool Segments
id segment      size     # buffs
0  0x4d73f000   158Mb    10000

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

Fast Cache Stats
gets       hits       %hits   puts
3051       2849       93.38   3429

[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服务器向快速缓存中插入缓冲区的次数

打印运行时间统计信息

语法

gstat -g cpu

操作演示

[gbasedbt@devsvr ~]$ gstat -g cpu
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 01:22:15 -- 333720 Kbytes

Thread CPU Info:
 tid    name              vp       Last Run           CPU Time     #scheds    status
 2      lio vp 0          3lio*   10/18 03:57:14        0.0297         63    IO Idle
 3      pio vp 0          4pio*   10/18 03:57:14        0.1195         14    IO Idle
 4      aio vp 0          5aio*   10/18 03:57:14        0.1878        835    IO Idle
 5      msc vp 0          6msc*   10/18 03:48:44        0.0083          5    IO Idle
 6      fifo vp 0         7fifo*  10/18 02:41:37        0.1005          2    IO Idle
 7      main_loop()       1cpu    10/18 04:03:47        0.0350       5170    sleeping secs: 1
 8      soctcppoll        8soc*   10/18 04:03:47     4929.8230      20169    running
 9      soctcplst         1cpu*   10/18 03:48:44        0.0164         50    sleeping forever
 10     flush_sub(0)      1cpu    10/18 04:03:47        0.0041       4954    sleeping secs: 1
 11     flush_sub(1)      1cpu    10/18 04:03:47        0.0036       4939    sleeping secs: 1
 12     flush_sub(2)      1cpu    10/18 04:03:47        0.0044       4932    sleeping secs: 1
 13     flush_sub(3)      1cpu    10/18 04:03:47        0.0089       4928    sleeping secs: 1
 14     flush_sub(4)      1cpu    10/18 04:03:47        0.0036       4928    sleeping secs: 1
 15     flush_sub(5)      1cpu    10/18 04:03:47        0.0042       4928    sleeping secs: 1
 16     flush_sub(6)      1cpu    10/18 04:03:47        0.0041       4929    sleeping secs: 1
 17     flush_sub(7)      1cpu    10/18 04:03:47        0.0040       4929    sleeping secs: 1
 18     aio vp 1          9aio*   10/18 03:52:14        0.1153         90    IO Idle
 19     aio vp 2         10aio*   10/18 03:37:13        0.1130         38    IO Idle
 20     aio vp 3         11aio*   10/18 03:37:13        0.1200         29    IO Idle
 21     aio vp 4         12aio*   10/18 03:37:13        0.1174         27    IO Idle
 22     aio vp 5         13aio*   10/18 03:37:13        0.1065         23    IO Idle
 23     aio vp 6         14aio*   10/18 03:37:13        0.1040         20    IO Idle
 24     aio vp 7         15aio*   10/18 03:37:13        0.1037         19    IO Idle
 25     aio vp 8         16aio*   10/18 03:37:13        0.1019         17    IO Idle
 26     aio vp 9         17aio*   10/18 03:37:13        0.0337         13    IO Idle
 27     aio vp 11        18aio*   10/18 02:42:44        0.0003          6    IO Idle
 28     aio vp 10        19aio*   10/18 03:37:13        0.0005          8    IO Idle
 29     aio vp 12        20aio*   10/18 02:42:44        0.0000          5    IO Idle
 30     aio vp 13        21aio*   10/18 02:42:44        0.0000          4    IO Idle
 31     aio vp 14        22aio*   10/18 02:42:44        0.5042          5    IO Idle
 32     aslogflush        1cpu    10/18 04:03:47        0.0159       4925    sleeping secs: 1
 33     btscanner_0       1cpu    10/18 04:02:51        0.0104        194    sleeping secs: 70
 34     readahead_0       1cpu    10/18 04:01:42        0.0024        235    cond wait  ReadAhead
 35     auto_tune         1cpu    10/18 04:03:47        0.0102       4924    sleeping secs: 1
 52     onmode_mon        1cpu*   10/18 04:03:47        0.0184       4922    sleeping secs: 1
 53     periodic          1cpu    10/18 04:03:47        0.0431       4922    sleeping secs: 1
 54     memory            1cpu    10/18 02:41:42        0.0005          1    sleeping forever
 64     dbutil            1cpu    10/18 04:03:47        0.0106       4948    sleeping secs: 1
 65     dbScheduler       1cpu    10/18 04:01:01        0.0658       1860    sleeping secs: 134
 66     dbWorker1         1cpu    10/18 03:34:24        0.0101        142    sleeping forever
 67     dbWorker2         1cpu    10/18 03:36:00        0.0526       3464    sleeping forever
 71     bf_priosweep()    1cpu    10/18 04:02:14        0.0137         91    cond wait  bp_cond
 73     sqlexec           1cpu    10/18 03:49:05        0.0012         12    cond wait  netnorm


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

打印数据库服务器信息

语法

gstat -g dis

操作演示

[gbasedbt@devsvr ~]$ gstat -g dis
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 01:23:35 -- 333720 Kbytes
There are 1 servers found
Server        : gbase8s
Server Number : 1
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.gbase8s
SQLHOSTS      : /opt/gbase/etc/sqlhosts.gbase8s
Host          : devsvr


[gbasedbt@devsvr ~]$

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

语法

gstat -g dri

操作演示

[gbasedbt@devsvr ~]$ gstat -g dri
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 01:24:33 -- 333720 Kbytes

Data Replication at 0x467f9028:
  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 和页

打印全局多线程信息

语法

gstat -g glo

操作演示

[gbasedbt@devsvr ~]$ gstat -g glo
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 01:25:48 -- 333720 Kbytes

MT global info:
sessions threads  vps      lngspins time
1        43       22       0        5148

          sched calls     thread switches yield 0   yield n   yield forever
total:    108171          82249           26319     72106     2212
per sec:  45              45              0         42        0

Virtual processor summary:
 class       vps       usercpu   syscpu    total
 cpu         1         1.22      0.58      1.80
 aio         15        0.17      0.88      1.05
 lio         1         0.00      0.09      0.09
 pio         1         0.00      0.08      0.08
 adm         1         0.00      0.41      0.41
 soc         1         0.43      0.33      0.76
 msc         1         0.00      0.00      0.00
 fifo        1         0.00      0.07      0.07
 total       22        1.82      2.44      4.26

Individual virtual processors:
 vp    pid       class       usercpu   syscpu    total     Thread    Eff
 1     4535      cpu         1.22      0.58      1.80      2.84      63%
 2     4536      adm         0.00      0.41      0.41      0.00       0%
 3     4537      lio         0.00      0.09      0.09      0.09     100%
 4     4538      pio         0.00      0.08      0.08      0.08     100%
 5     4539      aio         0.00      0.14      0.14      0.14     100%
 6     4540      msc         0.00      0.00      0.00      0.00       0%
 7     4541      fifo        0.00      0.07      0.07      0.07     100%
 8     4542      soc         0.43      0.33      0.76      NA         NA
 9     4543      aio         0.01      0.06      0.07      0.07     100%
 10    4544      aio         0.00      0.07      0.07      0.07     100%
 11    4545      aio         0.00      0.07      0.07      0.07     100%
 12    4546      aio         0.00      0.06      0.06      0.06     100%
 13    4547      aio         0.00      0.06      0.06      0.06     100%
 14    4548      aio         0.03      0.03      0.06      0.06     100%
 15    4549      aio         0.02      0.06      0.08      0.08     100%
 16    4550      aio         0.00      0.07      0.07      0.07     100%
 17    4551      aio         0.03      0.03      0.06      0.06     100%
 18    4552      aio         0.02      0.04      0.06      0.06     100%
 19    4553      aio         0.01      0.05      0.06      0.06     100%
 20    4554      aio         0.01      0.05      0.06      0.06     100%
 21    4555      aio         0.03      0.03      0.06      0.06     100%
 22    4556      aio         0.01      0.06      0.07      0.07     100%
                 tot         1.82      2.44      4.26

[gbasedbt@devsvr ~]$

虚拟处理器摘要

列名描述
sessions会话数
threads线程总数
vps虚拟处理器的总数
lngspins线程不得不 spin 超过 10,000 次以获得资源上的 latch 的次数
time生成统计信息的时间。服务器启动时开始统计或通过运行 gstat -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统计信息

语法

gstat -g iof

操作演示

[gbasedbt@devsvr ~]$ gstat -g iof
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 01:27:16 -- 333720 Kbytes

AIO global files:
gfd pathname         bytes read     page reads  bytes write    page writes io/s
3   rootdbs.dbf      2519040        1230        264192         129         12859.8
	op type     count          avg. time
	seeks       0              N/A
	reads       597            0.0000
	writes      87             0.0006
	kaio_reads  0              N/A
	kaio_writes 0              N/A

4   llogdbs.dbf      1052672        514         202752         99          1752.4
	op type     count          avg. time
	seeks       0              N/A
	reads       3              0.0030
	writes      63             0.0005
	kaio_reads  0              N/A
	kaio_writes 0              N/A

5   plogdbs.dbf      47104          23          305152         149         947.9
	op type     count          avg. time
	seeks       0              N/A
	reads       5              0.0000
	writes      13             0.0015
	kaio_reads  0              N/A
	kaio_writes 0              N/A

6   tempdbs1.dbf     49152          24          262144         128         64964.0
	op type     count          avg. time
	seeks       0              N/A
	reads       3              0.0000
	writes      10             0.0000
	kaio_reads  0              N/A
	kaio_writes 0              N/A

7   tempdbs2.dbf     49152          24          262144         128         81757.8
	op type     count          avg. time
	seeks       0              N/A
	reads       3              0.0000
	writes      10             0.0000
	kaio_reads  0              N/A
	kaio_writes 0              N/A

8   tempdbs3.dbf     49152          24          147456         72          63405.3
	op type     count          avg. time
	seeks       0              N/A
	reads       3              0.0000
	writes      6              0.0000
	kaio_reads  0              N/A
	kaio_writes 0              N/A

9   binspaces_1.dbf  26624          13          0              0           402560.9
	op type     count          avg. time
	seeks       0              N/A
	reads       13             0.0000
	writes      0              N/A
	kaio_reads  0              N/A
	kaio_writes 0              N/A

10  binspaces_2.dbf  26624          13          0              0           268688.3
	op type     count          avg. time
	seeks       0              N/A
	reads       13             0.0000
	writes      0              N/A
	kaio_reads  0              N/A
	kaio_writes 0              N/A

11  sbspaces_1.dbf   30720          15          2048           1           33177.9
	op type     count          avg. time
	seeks       0              N/A
	reads       15             0.0000
	writes      1              0.0003
	kaio_reads  0              N/A
	kaio_writes 0              N/A

12  sbspaces_2.dbf   2048           1           0              0           302358.9
	op type     count          avg. time
	seeks       0              N/A
	reads       1              0.0000
	writes      0              N/A
	kaio_reads  0              N/A
	kaio_writes 0              N/A

13  datadbs1_1.dbf   815104         398         10240          5           64150.0
	op type     count          avg. time
	seeks       0              N/A
	reads       177            0.0000
	writes      5              0.0004
	kaio_reads  0              N/A
	kaio_writes 0              N/A

14  datadbs2_1.dbf   4096           2           2048           1           8148.6
	op type     count          avg. time
	seeks       0              N/A
	reads       2              0.0000
	writes      1              0.0004
	kaio_reads  0              N/A
	kaio_writes 0              N/A

15  datadbs3_1.dbf   4096           2           2048           1           5827.7
	op type     count          avg. time
	seeks       0              N/A
	reads       2              0.0000
	writes      1              0.0005
	kaio_reads  0              N/A
	kaio_writes 0              N/A

16  datadbs4_1.dbf   4096           2           2048           1           8090.6
	op type     count          avg. time
	seeks       0              N/A
	reads       2              0.0000
	writes      1              0.0003
	kaio_reads  0              N/A
	kaio_writes 0              N/A

17  datadbs5_1.dbf   4096           2           2048           1           9085.5
	op type     count          avg. time
	seeks       0              N/A
	reads       2              0.0000
	writes      1              0.0003
	kaio_reads  0              N/A
	kaio_writes 0              N/A


[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 全局信息

语法

gstat -g iog

操作演示

[gbasedbt@devsvr ~]$ gstat -g iog
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 01:28:41 -- 333720 Kbytes

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

[gbasedbt@devsvr ~]$

打印 I/O 队列信息

语法

gstat -g ioq

操作演示

[gbasedbt@devsvr ~]$ gstat -g ioq
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 01:35:39 -- 333720 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
  adt   0      0      0        0        0        0        0
  msc   0      0      1        3        0        0        0
  aio   0      0     14      146       22        0        0
  pio   0      0      1       13        0       13        0
  lio   0      0      1       64        0       64        0
  gfd   3      0    127     1016      885      131        0
  gfd   4      0      1        4        3        1        0
  gfd   5      0      1        6        5        1        0
  gfd   6      0      7       19        3       16        0
  gfd   7      0      7       19        3       16        0
  gfd   8      0      5       12        3        9        0
  gfd   9      0      1       13       13        0        0
  gfd  10      0      1       13       13        0        0
  gfd  11      0      2       16       15        1        0
  gfd  12      0      1        1        1        0        0
  gfd  13      0     74      285      280        5        0
  gfd  14      0      1        3        2        1        0
  gfd  15      0      1        3        2        1        0
  gfd  16      0      1        3        2        1        0
  gfd  17      0      1        3        2        1        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 统计信息

语法

gstat -g iov

操作演示

[gbasedbt@devsvr ~]$ gstat -g iov
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 01:37:10 -- 333720 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
  msc  6  0 i   0.0        3        0        0        0        4   0.8       0        3
  aio  5  0 i   0.1      860      706       42        0      832   1.0       0        0
  aio  9  1 i   0.0      107       75       30        0       87   1.2       0        0
  aio 10  2 i   0.0       49       24       23        0       35   1.4       0        0
  aio 11  3 i   0.0       23       11       10        0       25   0.9       0        0
  aio 12  4 i   0.0       11        4        6        0       24   0.5       0        0
  aio 13  5 i   0.0       36       28        7        0       19   1.9       0        0
  aio 14  6 i   0.0        5        0        3        0       17   0.3       0        0
  aio 15  7 i   0.0        2        0        1        0       15   0.1       0        0
  aio 16  8 i   0.0        3        0        2        0       14   0.2       0        0
  aio 17  9 i   0.0       11        9        2        0       12   0.9       0        0
  aio 19 10 i   0.0        6        5        1        0        8   0.8       0        0
  aio 18 11 i   0.0        1        1        0        0        6   0.2       0        0
  aio 20 12 i   0.0        0        0        0        0        5   0.0       0        0
  aio 21 13 i   0.0        0        0        0        0        4   0.0       0        0
  aio 22 14 i   0.0        0        0        0        0        4   0.0       0        0
  pio  4  0 i   0.0       13        0       13        0       14   0.9       0       13
  lio  3  0 i   0.0       64        0       64        0       65   1.0       0       64

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

打印池内存统计信息

语法

gstat -g mem

操作演示

[gbasedbt@devsvr ~]$ gstat -g mem
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 01:39:06 -- 333720 Kbytes

Pool Summary:
name         class addr             totalsize        freesize         #allocfrag #freefrag
aqtpool      V     46404040         8192             1168             6          2
afpool       V     44bd3040         12288            5104             6          4
tpcpool      V     463c5040         28672            3232             23         3
seqpool      V     463f9040         4096             736              2          1
pnlpool      V     463c8040         32768            1680             28         2
sbtlist      V     45496040         20480            7200             4          3
dstpool      V     463c4040         8192             3728             2          2
tenprp_cach  V     46847040         8192             4008             8          1
ampool       V     463f1040         4096             304              7          1
srvnm_cache  V     463b4040         8192             3920             9          1
32*O0        V     57c0d040         4096             808              1          1
main_loop()  V     467db040         188416           13400            40         16
sb_delundoq  V     454ce040         49152            8752             4          3
XTF_mem      V     4665f040         724992           5008             4          3
25*O0        V     57894040         4096             808              1          1
EXE.25.65    V     57bfd040         4096             680              3          1
EXE.25.65    V     57c89040         32768            288              281        1
26*O0        V     57b61040         4096             808              1          1
27*O0        V     57a8e040         4096             808              1          1
EXE.26.66    V     57913040         4096             680              3          1
EXE.26.66    V     57be8040         4096             744              2          1
EXE.26.66    V     57bfe040         4096             544              5          1
EXE.26.66    V     57b5a040         4096             360              8          1
EXE.27.67    V     57bcd040         4096             744              2          1
EXE.27.67    V     57bfa040         4096             544              5          1
EXE.27.67    V     57a68040         4096             360              8          1
RA_req_64_3  V     57dd5040         40960            896              3          2
bf_prioswee  V     468f2040         28672            3056             13         4
RA_req_66_1  V     57c0e040         4096             112              2          1
RA_req_65_3  V     5793f040         40960            896              3          2
pmpool       V     463c9040         8192             3728             2          2
RA_req_65_4  V     57998040         4096             112              2          1
memory       V     57d77040         28672            3056             13         4
SES.25.65    V     57968040         8192             1400             7          2
RA_req_66_6  V     5786e040         4096             112              2          1
RA_req_65_8  V     57892040         4096             112              2          1
RA_req_67_6  V     57a9d040         4096             112              2          1
SES.26.66    V     57bb8040         8192             3736             3          2
GridQuery    V     458ad040         4096             736              2          1
SES.27.67    V     57aad040         8192             3736             3          2
readahead_0  V     5781f040         135168           8880             135        7
userlbacpoo  V     463cd040         8192             3728             2          2
PRP.25.65    V     5788d040         4096             216              4          1
ritem        V     45640040         16384            2744             10         2
PRP.26.66    V     57a47040         4096             400              3          1
onlinereorg  V     467ed040         20480            1720             4          3
PRP.27.67    V     57a56040         4096             400              3          1
onmode_mon   V     57d3d040         28672            3056             13         4
lgflushpool  V     46b33040         4096             504              3          1
2            V     4682a040         16384            2672             17         2
rsam         V     45572040         811008           1416             1036       3
sqcrypto_na  V     458b1040         4096             464              2          1
sscpool0     V     463ba040         12288            1584             2          2
3            V     46849040         20480            5152             23         4
SYS.29.69    V     57ba0040         8192             3832             2          2
aslogflush   V     46b34040         28672            3056             13         4
aio          V     458a8040         1294336          109880           367        50
opcinstpool  V     463c7040         8192             2704             3          2
dbausrpool   V     46400040         8192             3976             8          2
smartblob    V     45495040         16384            6320             8          2
gls          V     463b6040         1327104          3936             6197       7
policypool   V     463cc040         8192             3728             2          2
DefConvWrit  V     4665b040         16384            2776             102        1
proxyWrite   V     45489040         49152            2832             2          2
sysprocpool  V     46401040         8192             3632             3          2
resroutpool  V     463cb040         8192             3728             2          2
btscanner_0  V     57802040         98304            18576            36         9
periodic     V     57d5a040         28672            3056             13         4
auto_tune    V     5783c040         49152            6736             29         5
smx          V     4639a040         8192             3392             11         2
sb_delq      V     4549b040         49152            8752             4          3
resident     R     4408c040         11292672         22216            10         9
dictpool     V     463bb040         479232           3328             124        3
grgid_cache  V     463a5040         8192             3920             9          1
mt           V     44bd4040         10833920         11216            5998       129
sqlhistory   V     46406040         2060288          920              1002       2
env_vars     V     44bb3040         61440            2944             341        1
32           V     57ac7040         81920            15616            89         10
24           V     57de2040         102400           16936            66         13
33           V     46a96040         16384            2672             17         2
hstad_cache  V     463aa040         16384            136              133        1
25           V     57dd1040         671744           189112           483        68
26           V     57989040         475136           71992            421        36
aggpool      V     463ca040         8192             3728             2          2
27           V     578e6040         483328           92920            401        45
procpool     V     463c1040         360448           11208            365        22
extdpool     V     463fa040         8192             2408             6          2
global       V     44bb2040         15257600         849504           3332       250
Shard        V     458ae040         12288            4768             3          2
spnam_cache  V     463a3040         8192             2776             21         1
compr_cache  V     458aa040         8192             4008             8          1
ctcpool      V     463c6040         65536            3728             58         3
tmxapool     V     463ff040         4096             680              3          1
sb_arcspace  V     4556c040         8192             1752             4          2
pwnam_cache  V     4639c040         12288            2744             41         3
sb_loheader  V     45500040         282624           6528             413        57
RSS          V     467fb040         188416           3536             507        43
rascron      V     57d94040         36864            7784             24         7
inhpool      V     463f3040         8192             2848             23         1
pwuid_cache  V     463a0040         8192             2776             21         1
opcpool      V     463f2040         8192             3272             18         1
hstnm_cache  V     463a8040         8192             3568             13         1

Blkpool Summary:
name         class addr             size             #blks
mt           V     44bd6860         3321856          43
global       V     44bd0e20         0                0

[gbasedbt@devsvr ~]$

Pool Summary

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

Blkpool Summary

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

打印网络用户统计信息

语法

gstat -g ntu

操作演示

[gbasedbt@devsvr ~]$ gstat -g ntu
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 02:04:46 -- 333720 Kbytes

global network information:
  #netscb connects         read        write    q-free  q-limits  q-exceed alloc/max
   3/   3        4           58           58    0/   1  135/  10    0/   0    1/   1

Individual thread network information (basic):
          netscb type   thread name    sid   fd poll    reads   writes q-nrm q-pvt q-exp
        57c79598 soctcp sqlexec         32    2    5       11       11  0/ 1  1/ 1  0/ 0
        461a6b90 soctcp soctcplst        3    1    5        4        0  0/ 0  0/ 0  0/ 0
        461a2be0 soctcp soctcppoll       2    0    5       56        0  0/ 0  0/ 0  0/ 0


[gbasedbt@devsvr ~]$

打印网络用户时间

语法

gstat -g ntt

操作演示

[gbasedbt@devsvr ~]$ gstat -g ntt
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 02:06:21 -- 333720 Kbytes

global network information:
  #netscb connects         read        write    q-free  q-limits  q-exceed alloc/max
   3/   3        4           58           58    0/   1  135/  10    0/   0    1/   1

Individual thread network information (times):
          netscb thread name    sid     open     read    write address
        57c79598 sqlexec         32 03:48:44 03:49:05 03:49:05
        461a6b90 soctcplst        3 02:41:38 03:48:44          192.168.3.5|9088|soctcp
        461a2be0 soctcppoll       2 02:41:38


[gbasedbt@devsvr ~]$

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

语法

gstat -g opn

操作演示

[gbasedbt@devsvr ~]$ gstat -g opn
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 02:09:10 -- 333720 Kbytes
rstcb 0x45738068 tid 34
isfd  op_mode    op_flags   partnum    ucnt ocnt lk ra   partp          ocnt ucnt
0     0x70000    0x403      0x800003   1    0       0    0x57918028     0    1
1     0x70000    0x403      0x100086   1    0       0    0x57dd2028     4    5
2     0x70000    0x403      0x100095   1    0       0    0x57de1a48     0    1
3     0x70000    0x403      0x100089   1    0       0    0x578de028     0    1
4     0x70000    0x403      0x10008c   1    0       0    0x57dd2a28     0    1
5     0x70000    0x403      0x100087   1    0       0    0x578de9b0     0    1
......
30    0x70000    0x403      0x900049   1    0       0    0x57be6a30     0    1
31    0x70000    0x403      0x900005   1    0       0    0x57bb5548     0    1
32    0x70000    0x403      0x900004   1    0       0    0x57be78f8     0    1
33    0x70000    0x403      0x900047   1    0       0    0x57c4caf8     0    1
34    0x70000    0x403      0x1000d8   1    0       0    0x57af47f0     0    3

rstcb 0x457391e8 tid 73
isfd  op_mode    op_flags   partnum    ucnt ocnt lk ra   partp          ocnt ucnt
0     0x400      0x297      0x900002   2    2       1    0x57adb6c8     1    2
1     0x2        0x3        0x900002   2    2       0    0x57adb6c8     1    2

rstcb 0x4573bda8 tid 65
isfd  op_mode    op_flags   partnum    ucnt ocnt lk ra   partp          ocnt ucnt
0     0x400      0x297      0x100086   2    2       21   0x57dd2028     4    5
1     0x2        0x3        0x100086   2    2       0    0x57dd2028     4    5
2     0x1000400  0x3        0x1000ea   1    1    S  0    0x579268b8     1    1
3     0x1000440  0x3        0x1000eb   1    1       0    0x57956028     1    1
4     0x1000402  0x403      0x1000d1   2    0    IX 0    0x57986950     0    7
5     0x2        0x3        0x100004   2    2       0    0x57915880     1    2
6     0x400      0x297      0x100004   2    2       61   0x57915880     1    2
7     0x1000442  0x403      0x1000d3   1    0    S  0    0x57a735b0     0    3
8     0x1000400  0x403      0x1000d1   2    0    IX 1    0x57986950     0    7

rstcb 0x4573c668 tid 66
isfd  op_mode    op_flags   partnum    ucnt ocnt lk ra   partp          ocnt ucnt
0     0x400      0x297      0x100086   2    2       1    0x57dd2028     4    5
1     0x2        0x3        0x100086   2    2       0    0x57dd2028     4    5
2     0x1000400  0x403      0x1000d6   4    0    IX 0    0x57a73028     0    4
3     0x1000400  0x403      0x1000d1   2    0    IX 0    0x57986950     0    7
4     0x1000440  0x403      0x1000d3   2    0       0    0x57a735b0     0    3
5     0x1000440  0x403      0x1000d9   3    0    IX 1    0x57a847f0     0    3
6     0x1000402  0x403      0x1000d1   2    0    IX 0    0x57986950     0    7
7     0x1000442  0x403      0x1000d7   2    0    IX 0    0x57adb028     0    2
8     0x1000442  0x403      0x1000d3   2    0       0    0x57a735b0     0    3
9     0x1000442  0x403      0x1000d5   1    0    IX 0    0x578e8780     0    2
10    0x1000402  0x403      0x1000d6   4    0    IX 0    0x57a73028     0    4
11    0x1000442  0x403      0x1000d8   2    0    IX 0    0x57af47f0     0    3
12    0x1000442  0x403      0x1000d9   3    0    IX 0    0x57a847f0     0    3
13    0x1000402  0x403      0x1000d6   4    0    IX 0    0x57a73028     0    4
14    0x1000402  0x407      0x1000d6   4    0    IX 1    0x57a73028     0    4
15    0x1000442  0x403      0x1000d8   2    0    IX 21   0x57af47f0     0    3
16    0x1000442  0x403      0x1000d7   2    0    IX 0    0x57adb028     0    2
17    0x1000442  0x403      0x1000d9   3    0    IX 0    0x57a847f0     0    3

rstcb 0x4573cf28 tid 64
isfd  op_mode    op_flags   partnum    ucnt ocnt lk ra   partp          ocnt ucnt
0     0x400      0x317      0x100086   2    2       41   0x57dd2028     4    5
1     0x2        0x3        0x100086   2    2       0    0x57dd2028     4    5

rstcb 0x4573d7e8 tid 67
isfd  op_mode    op_flags   partnum    ucnt ocnt lk ra   partp          ocnt ucnt
0     0x400      0x297      0x100086   2    2       1    0x57dd2028     4    5
1     0x2        0x3        0x100086   2    2       0    0x57dd2028     4    5
2     0x1000400  0x403      0x1000d6   4    0    IX 0    0x57a73028     0    4
3     0x1000400  0x403      0x1000d1   2    0    IX 0    0x57986950     0    7
4     0x1000440  0x403      0x1000d3   2    0       0    0x57a735b0     0    3
5     0x1000440  0x403      0x1000d9   3    0    IX 1    0x57a847f0     0    3
6     0x1000442  0x403      0x1000d3   2    0       0    0x57a735b0     0    3
7     0x1000442  0x403      0x1000d5   1    0    IX 0    0x578e8780     0    2
8     0x1000402  0x403      0x1000d1   2    0    IX 0    0x57986950     0    7
9     0x1000402  0x403      0x1000d6   4    0    IX 0    0x57a73028     0    4
10    0x1000442  0x403      0x1000d7   2    0    IX 0    0x57adb028     0    2
11    0x1000442  0x403      0x1000d8   2    0    IX 0    0x57af47f0     0    3
12    0x1000442  0x403      0x1000d9   3    0    IX 0    0x57a847f0     0    3
14    0x1000402  0x407      0x1000d6   4    0    IX 1    0x57a73028     0    4
16    0x1000402  0x403      0x1000d6   4    0    IX 0    0x57a73028     0    4
17    0x1000442  0x403      0x1000d9   3    0    IX 0    0x57a847f0     0    3
21    0x1000442  0x403      0x1000d8   2    0    IX 1    0x57af47f0     0    3
22    0x1000442  0x403      0x1000d7   2    0    IX 0    0x57adb028     0    2


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

打印 VP 信息

语法

gstat -g sch

操作演示

[gbasedbt@devsvr ~]$ gstat -g sch
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 02:11:30 -- 333720 Kbytes

VP Scheduler Statistics:
 vp    pid       class       semops    busy waits  spins/wait  bsy lspins
 1     4535      cpu         8832      0           0           0
 2     4536      adm         0         0           0           0
 3     4537      lio         98        0           0           0
 4     4538      pio         20        0           0           0
 5     4539      aio         867       0           0           0
 6     4540      msc         5         0           0           0
 7     4541      fifo        2         0           0           0
 8     4542      soc         2         0           0           0
 9     4543      aio         95        0           0           0
 10    4544      aio         42        0           0           0
 11    4545      aio         33        0           0           0
 12    4546      aio         32        0           0           0
 13    4547      aio         27        0           0           0
 14    4548      aio         24        0           0           0
 15    4549      aio         21        0           0           0
 16    4550      aio         19        0           0           0
 17    4551      aio         14        0           0           0
 18    4552      aio         7         0           0           0
 19    4553      aio         10        0           0           0
 20    4554      aio         6         0           0           0
 21    4555      aio         5         0           0           0
 22    4556      aio         5         0           0           0

Thread Migration Statistics:
 vp    pid       class      steal-at steal-sc idlvp-at idlvp-sc inl-polls Q-ln
 1     4535      cpu        0        0        0        0        0         0
 2     4536      adm        0        0        0        0        0         0
 3     4537      lio        0        0        0        0        0         0
 4     4538      pio        0        0        0        0        0         0
 5     4539      aio        0        0        0        0        0         0
 6     4540      msc        0        0        0        0        0         0
 7     4541      fifo       0        0        0        0        0         0
 8     4542      soc        0        0        0        0        0         0
 9     4543      aio        0        0        0        0        0         0
 10    4544      aio        0        0        0        0        0         0
 11    4545      aio        0        0        0        0        0         0
 12    4546      aio        0        0        0        0        0         0
 13    4547      aio        0        0        0        0        0         0
 14    4548      aio        0        0        0        0        0         0
 15    4549      aio        0        0        0        0        0         0
 16    4550      aio        0        0        0        0        0         0
 17    4551      aio        0        0        0        0        0         0
 18    4552      aio        0        0        0        0        0         0
 19    4553      aio        0        0        0        0        0         0
 20    4554      aio        0        0        0        0        0         0
 21    4555      aio        0        0        0        0        0         0
 22    4556      aio        0        0        0        0        0         0


[gbasedbt@devsvr ~]$

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

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

语法

gstat -g seg

操作演示

[gbasedbt@devsvr ~]$ gstat -g seg
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 02:13:11 -- 333720 Kbytes

Segment Summary:
id         key        addr             size             ovhd     class blkused  blkfree
1179648    52574801   44000000         11866112         572216   R     2897     0
1212417    52574802   44b51000         33439744         393384   V     8164     0
1245186    52574803   46b35000         113287168        1        B     27658    0
1277955    52574804   4d73f000         166359040        1        B     40615    0
1310724    52574805   575e6000         8388608          99720    V     1831     217
1343493    52574806   57de6000         8388608          99720    V     25       2023
Total:     -          -                341729280        -        -     81190    2240

   (* 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连接信息。

语法

gstat -g ses [session_id]

操作演示

[gbasedbt@devsvr ~]$ gstat -g ses
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 02:14:13 -- 333720 Kbytes

session                                      #RSAM    total      used       dynamic
id       user     tty      pid      hostname threads  memory     memory     explain
33       gbasedbt -        0        -        0        16384      13712      off
32       gbasedbt 0        4795     devsvr   1        86016      69592      off
27       gbasedbt -        0        -        1        499712     412488     off
26       gbasedbt -        0        -        1        503808     414152     off
25       gbasedbt -        0        -        1        675840     485928     off
24       gbasedbt -        0        -        1        102400     85464      off
3        gbasedbt -        0        -        0        20480      15328      off
2        gbasedbt -        0        -        0        16384      13712      off

[gbasedbt@devsvr ~]$

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

[gbasedbt@devsvr ~]$ gstat -g ses 32
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 02:14:55 -- 333720 Kbytes

session           effective                            #RSAM    total      used       dynamic
id       user     user      tty      pid      hostname threads  memory     memory     explain
32       gbasedbt -         0        4795     devsvr   1        86016      69592      off

Program :
/opt/gbase/bin/dbaccess

tid      name     rstcb            flags    curstk   status
73       sqlexec  457391e8         Y-BP---  3936     cond wait  netnorm   -

Memory pools    count 2
name         class addr              totalsize  freesize   #allocfrag #freefrag
32           V     57ac7040         81920      15616      89         10
32*O0        V     57c0d040         4096       808        1          1

name           free       used           name           free       used
overhead       0          6576           scb            0          144
opentable      0          3792           filetable      0          616
ru             0          600            log            0          16536
temprec        0          2208           keys           0          176
ralloc         0          1024           gentcb         0          1616
ostcb          0          2968           sqscb          0          20928
sql            0          72             hashfiletab    0          552
osenv          0          2752           sqtcb          0          8696
fragman        0          336

sqscb info
scb              sqscb            optofc   pdqpriority optcompind  directives
461fc290         57acf028         0        0           2           1

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

Last parsed SQL statement :
  update t_user set f_username = 'gbase8s' where f_userid = 2

[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 信息

语法

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

操作演示

[gbasedbt@devsvr ~]$ gstat -g smb c
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 02:17:18 -- 333720 Kbytes

Chunk Summary:

sbnum 8    chunk 9
    Chunk: address          flags    offset   size     orig fr  usr pgs  free pg
                   46ac9028 FR------ 0        51200    47678    47678    47678
           path: /opt/gbase/gbase8s_dbs/sbspaces_1.dbf

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

sbnum 8    chunk 10
    Chunk: address          flags    offset   size     orig fr  usr pgs  free pg
                   46aca028 -R------ 0        51200    47725    47725    47725
           path: /opt/gbase/gbase8s_dbs/sbspaces_2.dbf

           start pg npages
    Ud1  : 3        23862
    Md   : 23865    3472
    Ud2  : 27337    23863


[gbasedbt@devsvr ~]$

打印与 SQL 有关的会话信息

语法

gstat -g sql <Session_ID>

操作演示

[gbasedbt@devsvr ~]$ gstat -g sql 32
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 02:18:16 -- 333720 Kbytes


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

Last parsed SQL statement :
  update t_user set f_username = 'gbase8s' where f_userid = 2

[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没有事务的数据库

打印线程概要文件

语法

gstat -g tpf <thread_id>

操作演示

[gbasedbt@devsvr ~]$ gstat -g bth
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 02:19:37 -- 333720 Kbytes

This command attempts to identify any blocking threads.

No blocking thread identified.

Threads waiting on resources
 tid      name                 blocking resource              blocker
 34       readahead_0          Condition (ReadAhead)           -
 71       bf_priosweep()       Condition (bp_cond)             -
 73       sqlexec              Condition (netnorm)             -

[gbasedbt@devsvr ~]$ gstat -g tpf 73
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 02:19:59 -- 333720 Kbytes

Thread profiles
tid lkreqs lkw dl to lgrs isrd iswr isrw isdl isct isrb lx bfr bfw lsus lsmx seq
73  163    0   0  0  3    77   0    1    0    0    0    0  164 1   208  0    1

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

打印等待队列线程队列

语法

gstat -g wai

操作演示

[gbasedbt@devsvr ~]$ gstat -g wai
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 02:21:13 -- 333720 Kbytes

Waiting threads:
 tid     tcb              rstcb            prty status                vp-class       name
 2        4671d148         0                1    IO Idle                 3lio*        lio vp 0
 3        4673e368         0                1    IO Idle                 4pio*        pio vp 0
 4        4675f368         0                1    IO Idle                 5aio*        aio vp 0
 5        46780368         20e1f00          1    IO Idle                 6msc*        msc vp 0
 6        467b1368         0                1    IO Idle                 7fifo*       fifo vp 0
 7        467d2608         45732028         3    sleeping secs: 1        1cpu         main_loop()
 9        4684c808         0                2    sleeping forever        1cpu*        soctcplst
 10       468f02b0         457328e8         1    sleeping secs: 1        1cpu         flush_sub(0)
 11       468f05f0         457331a8         1    sleeping secs: 1        1cpu         flush_sub(1)
 12       468f0930         45733a68         1    sleeping secs: 1        1cpu         flush_sub(2)
 13       468f0c70         45734328         1    sleeping secs: 1        1cpu         flush_sub(3)
 14       468f1028         45734be8         1    sleeping secs: 1        1cpu         flush_sub(4)
 15       468f1368         457354a8         1    sleeping secs: 1        1cpu         flush_sub(5)
 16       468f16a8         45735d68         1    sleeping secs: 1        1cpu         flush_sub(6)
 17       468f19e8         45736628         1    sleeping secs: 1        1cpu         flush_sub(7)
 18       46ac12c8         0                1    IO Idle                 9aio*        aio vp 1
 19       46af0368         0                1    IO Idle                10aio*        aio vp 2
 20       46b11368         0                1    IO Idle                11aio*        aio vp 3
 21       46b32368         0                1    IO Idle                12aio*        aio vp 4
 22       5761f368         0                1    IO Idle                13aio*        aio vp 5
 23       57640368         0                1    IO Idle                14aio*        aio vp 6
 24       57661368         0                1    IO Idle                15aio*        aio vp 7
 25       57682368         0                1    IO Idle                16aio*        aio vp 8
 26       576a3368         0                1    IO Idle                17aio*        aio vp 9
 27       576c46a8         0                1    IO Idle                18aio*        aio vp 11
 28       576c4368         0                1    IO Idle                19aio*        aio vp 10
 29       576c49e8         0                1    IO Idle                20aio*        aio vp 12
 30       576c4d28         0                1    IO Idle                21aio*        aio vp 13
 31       46af0760         0                1    IO Idle                22aio*        aio vp 14
 32       57769758         45736ee8         2    sleeping secs: 1        1cpu         aslogflush
 33       46b118a0         457377a8         1    sleeping secs: 40       1cpu         btscanner_0
 34       5761f750         45738068         3    cond wait  ReadAhead    1cpu         readahead_0
 35       576616a8         45738928         3    sleeping secs: 1        1cpu         auto_tune
 52       57d220e8         45739aa8         3    sleeping secs: 1        1cpu*        onmode_mon
 53       57d22428         4573ac28         3    sleeping secs: 1        1cpu         periodic
 54       57d22768         4573b4e8         3    sleeping forever        1cpu         memory
 64       57de3760         4573cf28         1    sleeping secs: 1        1cpu         dbutil
 65       57dc0760         4573bda8         1    sleeping secs: 135      1cpu         dbScheduler
 66       57880610         4573c668         1    sleeping forever        1cpu         dbWorker1
 67       579c5610         4573d7e8         1    sleeping forever        1cpu         dbWorker2
 71       57c50c60         4573a368         1    cond wait  bp_cond      1cpu         bf_priosweep()
 73       57c005c8         457391e8         1    cond wait  netnorm      1cpu         sqlexec


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

打印线程的等待统计信息

语法

gstat -g wst

操作演示

[gbasedbt@devsvr ~]$ gstat -g cfg | grep WSTATS
Your evaluation license will expire on 2022-10-14 00:00:00
WSTATS                    0
[gbasedbt@devsvr ~]$ gadmin -wf WSTATS=1
Your evaluation license will expire on 2022-10-14 00:00:00
Value of WSTATS has been changed to 1.
[gbasedbt@devsvr ~]$ gstat -g cfg | grep WSTATS
Your evaluation license will expire on 2022-10-14 00:00:00
WSTATS                    1
[gbasedbt@devsvr ~]$ gstat -g wst
Your evaluation license will expire on 2022-10-14 00:00:00
On-Line -- Up 02:25:37 -- 333720 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线程产生并保持这种方式,直到它被唤醒
  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值