GBASE南大通用技术分享:GBase 8s数据库检查服务进程

105 阅读2分钟

通常情况下,南大通用GBase 8s数据库使用 gbasedbt 用户来启动和停止数据库服务。

1. 检查数据库运行状态

    通常情况下,使用 gbasedbt 用户来启动和停止数据库服务。成功安装数据库 GBase 8s 后,数据库会自动处于启动状态,会运行名称为oninit的进程,可通过 ps -ef|grep oninit 命令检查服务进程是否存在:

[root@vip ~]# ps -ef|grep oninit
gbasedbt  11114      1  0 14:00 ?        00:00:00 /opt/GBASE/gbase/bin/oninit -ivwy
root      11126  11114  0 14:00 ?        00:00:00 /opt/GBASE/gbase/bin/oninit -ivwy
root      11141  11126  0 14:00 ?        00:00:00 /opt/GBASE/gbase/bin/oninit -ivwy
root      11146  11126  0 14:00 ?        00:00:00 /opt/GBASE/gbase/bin/oninit -ivwy
root      11163  11126  0 14:00 ?        00:00:00 /opt/GBASE/gbase/bin/oninit -ivwy
root      11168  11126  0 14:00 ?        00:00:00 /opt/GBASE/gbase/bin/oninit -ivwy
root      11173  11126  0 14:00 ?        00:00:00 /opt/GBASE/gbase/bin/oninit -ivwy
root      11179  11126  0 14:00 ?        00:00:00 /opt/GBASE/gbase/bin/oninit -ivwy
root      16102 114275  0 14:31 pts/1    00:00:00 grep --color=auto oninit
[root@vip ~]# 

使用onstat命令,查看数据库运行状态,此命令执行成功的前提是环境变量配置成功。

[root@vip ~]# su - gbasedbt 
Last login: Mon Apr 24 14:21:51 CST 2023 on pts/1
[gbasedbt@vip ~]$ onstat -
Your evaluation license will expire on 2024-04-23 00:00:00
On-Line -- Up 00:35:26 -- 175748 Kbytes

[gbasedbt@vip ~]$ 

2.关闭数据库****并检查数据库运行状态

    以 gbasedbt 用户身份登录后,输入 onmode -ky,可停止数据库服务,示例如下:

[gbasedbt@vip ~]$ onmode -ky
Your evaluation license will expire on 2024-04-23 00:00:00
--使用onstat命令查看数据库状态,显示共享内存没有初始化,数据库处于离线状态。
[gbasedbt@vip ~]$ onstat -
Your evaluation license will expire on 2024-04-23 00:00:00
shared memory not initialized for GBASEDBTSERVER 'ol_gbasedbt1210'
--使用ps命令查看数据库的进程信息,发现没有oninit进程存在。
[gbasedbt@vip ~]$ ps -ef|grep oninit
gbasedbt  16833  16565  0 14:37 pts/1    00:00:00 grep --color=auto oninit
[gbasedbt@vip ~]$ 

3.启动数据库并检查数据库运行状态

    输入 oninit -vy,启动数据库服务,示例如下:

[gbasedbt@vip ~]$ oninit -vy
Your evaluation license will expire on 2024-04-23 00:00:00
Warning: Parameter's user-configured value was adjusted. (DS_MAX_SCANS)
Warning: Parameter's user-configured value was adjusted. (ONLIDX_MAXMEM)
Reading configuration file '/opt/GBASE/gbase/etc/onconfig.ol_gbasedbt1210'...succeeded
Creating /GBASEDBTTMP/.infxdirs...succeeded
Allocating and attaching to shared memory...succeeded
Creating resident pool 8310 kbytes...succeeded
Creating infos file "/opt/GBASE/gbase/etc/.infos.ol_gbasedbt1210"...succeeded
Linking conf file "/opt/GBASE/gbase/etc/.conf.ol_gbasedbt1210"...succeeded
Initializing rhead structure...rhlock_t 16384 (512K)... rlock_t (5312K)... 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
Forking 1 'soctcp' listener threads...succeeded
Forking 1 'soctcp' listener threads...succeeded
Starting tracing...succeeded
Initializing 2 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 onmode_mon thread...succeeded
Creating periodic thread...succeeded
Creating periodic thread...succeeded
Starting scheduling system...succeeded
Verbose output complete: mode = 5
[gbasedbt@vip ~]$ 

 

继续输入 ps -ef|grep oninit 检查数据库服务进程是否存在:

--使用ps命令查看数据库的进程信息,oninit进程存在
[gbasedbt@vip ~]$ ps -ef|grep oninit
gbasedbt  16986      1  0 14:38 ?        00:00:00 oninit -vy
root      16989  16986  0 14:38 ?        00:00:00 oninit -vy
root      16990  16989  0 14:38 ?        00:00:00 oninit -vy
root      16993  16989  0 14:38 ?        00:00:00 oninit -vy
root      16996  16989  0 14:38 ?        00:00:00 oninit -vy
root      16999  16989  0 14:38 ?        00:00:00 oninit -vy
root      17002  16989  0 14:38 ?        00:00:00 oninit -vy
root      17005  16989  0 14:38 ?        00:00:00 oninit -vy
gbasedbt  17479  16565  0 14:41 pts/1    00:00:00 grep --color=auto oninit
--使用onstat命令查看数据库状态,当前数据库处于OnLine状态
[gbasedbt@vip ~]$ onstat -
Your evaluation license will expire on 2024-04-23 00:00:00
On-Line -- Up 00:04:19 -- 175748 Kbytes

[gbasedbt@vip ~]$