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

第2章:GBase 8s 安装与卸载

文章目录

1 安装环境

VMWare虚拟机,2核CPU,2G内存,千兆网卡,预分配了20G的磁盘空间。

GBase 8s的数据库组件安装完成后,大约有500M,但存储物理日志,逻辑日志,智能大对象,临时数据和事务数据都需要使用磁盘存储空间,建议至少有10G以上的磁盘空闲空间。

检查服务器内存大小
[root@devsvr ~]# free -m
检查服务器磁盘空间大小
[root@devsvr ~]# df -h
检查服务器网络配置信息
[root@devsvr ~]# ifconfig
检查操作系统版本
[root@devsvr ~]# cat /etc/redhat-release

2 创建用户

检查操作系统是否存在gbasedbt用户
[root@devsvr ~]# cat /etc/passwd | grep gbasedbt
检查操作系统是否存在gbasedbt组
[root@devsvr ~]# cat /etc/group | grep gbasedbt

创建gbasedbt组和用户,并设置用户密码

[root@devsvr ~]# useradd gbasedbt
[root@devsvr ~]# passwd gbasedbt
[root@gbase01 ~]# cat /etc/passwd | grep gbasedbt
gbasedbt:x:1000:1000::/home/gbasedbt:/bin/bash
[root@gbase01 ~]# cat /etc/group | grep gbasedbt
gbasedbt:x:1000:

3 安装GBase 8s

—3.1 上传GBase 8s安装包到服务器

[root@devsvr ~]# ls /root/setup/
GBase8s_ExpressEdition.tar

—3.2 创建一个目录,将安装包解压到该目录

[root@devsvr ~]# mkdir install
[root@devsvr ~]# cd install/
[root@devsvr install]# tar xf /root/setup/GBase8s_ExpressEdition.tar
[root@devsvr install]# ls
doc ids_install ids.properties onsecurity
至此,安装数据库需要的软件包和用户都准备好了。

—3.3 安装GBase 8s数据库组件

GBase 8s数据库安装,支持图形界面方式和控制台的命令行方式。默认的安装方式是控制台命令行方式。如果希望使用图形界面安装,只需要在启动安装程序时,后面加上参数./ids_install -i swing即可。

安装过程中,会显示产品的License,内容较长,在控制台的命令行方式中,可以连续按5次回车。在图形界面方式中,需要用鼠标拉动界面右侧的滚动条到底部,就可以点那个复选框,确认License了。

我们在root用户下,进入安装包目录,运行安装命令ids_install,启动安装程序。
[root@devsvr install]# ./ids_install
Preparing to install...
Extracting the JRE from the installer archive...
Unpacking the JRE...
Extracting the installation resources from the installer archive...
Configuring the installer for this system's environment...

Launching installer...

===============================================================================
GBase Software Bundle (created with InstallAnywhere)
-------------------------------------------------------------------------------

Preparing CONSOLE Mode Installation...

===============================================================================
Getting Started
---------------

This application will guide you through the installation of GBase Software
Bundle.
Copyright General Data Corporation 2014, 2021. All rights reserved.

1. Release Notes
The Release Notes can be found in
/root/install/doc/ids_unix_relnotes_12.10.html.
2. Launch Information Center
Access the GBase Information Center at http://www.gbase.cn.
To Begin Installation, respond to each prompt to proceed to the next step in
the installation.
If you want to change something on a previous step, type 'back'.
You may cancel this installation at any time by typing 'quit'.

PRESS <ENTER> TO CONTINUE:
回车继续

===============================================================================
License Agreement
-----------------

Installation and Use of GBase Software Bundle Requires Acceptance of the
Following License Agreement:

Thank you for choosing GBase product!

Please read carefully the following licencing agreement before installing any
product: TIANJIN GENERAL DATA TECHNOLOGY CO. LTD. LICENSE AGREEMENT

READ THE TERMS OF THIS AGREEMENT AND ANY PROVIDED SUPPLEMENTAL LICENSETERMS
(COLLECTIVELY "AGREEMENT") CAREFULLY BEFORE OPENING THE SOFTWAREMEDIA PACKAGE.
BY OPENING THE SOFTWARE MEDIA PACKAGE, YOU AGREE TO THE TERMS OF THIS
AGREEMENT. IF YOU ARE ACCESSING THE SOFTWARE ELECTRONICALLY, INDICATE YOUR
ACCEPTANCE OF THESE TERMS. IF YOU DO NOT AGREE TO ALL THESE TERMS, PROMPTLY
RETURN THE UNUSED SOFTWARE TO YOUR PLACE OF PURCHASE FOR A REFUND.

1. LICENSE TO USE. GeneralData grants you a non-exclusive and non-transferable
license for the internal use only of the accompanying software and
documentation and any error corrections provided by GeneralData(collectively
"Software"), by the number of users and the class of computer hardware for
which the corresponding fee has been paid.

2. RESTRICTIONS. Software is confidential and copyrighted. Title to Software

PRESS <ENTER> TO CONTINUE:
回车继续

and all associated intellectual property rights is retained by GeneralData
and/or its licensors. Except as specifically authorized in any Supplemental
License Terms, you may not make copies of Software, other than a single copy
of Software for archival purposes. Unless enforcement is prohibited by
applicable law, you may not modify, decompile, or reverse engineer Software.
You acknowledge that Software is not designed, licensed or intended for use in
the design, construction, operation or maintenance of any nuclear facility.
GeneralData disclaims any express or implied warranty of fitness for such
uses. No right, title or interest in or to any trademark, service mark, logo or
trade name of GeneralData or its licensors is granted under this Agreement.

3. DISCLAIMER OF WARRANTY. Unless specified in this agreement, all express of
implied conditions, representations and warranties, including any implied
warranty of merchantability, fitness for aparticular purpose or
non-infringement are disclaimed, except to theextent that these disclaimers
are held to be legally invalid.

4. LIMITATION OF LIABILITY. To the extent not prohibited by law, in no event
will GeneralData or its licensors be liable for any lost revenue, profit or
data, or for special, indirect, consequential, incidental orpunitive damages,
however caused regardless of the theory of liability, arising out of or
related to the use of or inability to use software, even if GeneralData has

PRESS <ENTER> TO CONTINUE:
回车继续

been advised of the possibility of such damages. In no event will
GeneralData's libility to you, whether incontract, tort(including negligence),
or otherwise, exceed the amount paid by you for Software under this Agreement.
The foregoing limitations will apply even if the above stated warranty fails
of itsessential purpose.

5. TERMINATION. This Agreement is effective until terminated. You may terminate
this Agreement at any time by destroying all copies of Software. This
Agreement will terminate immediately without noticefrom GeneralData if you
fail to comply with any provision of this Agreement. Upon Termination, you
must destroy all copies of Software.

6. EXPORT REGULATIONS. All Software and technical data delivered under this
Agreement are subject to US export control laws and may be subject to export
or import regulations in other countries. You agree to comply strictly with
all such laws and regulations and acknowledge that you have the responsibility
to obtain such licenses to export, re-export, or import as may be required
after delivery to you.

7. CHINESE GOVERNMENT RESTRICTED. If Software is being acquired by or on behalf

PRESS <ENTER> TO CONTINUE:
回车继续

of the Chinese Government, then the Government's rights in Software and
accompanying documentation will be only as set forth in this Agreement.

8. GOVERNING LAW. Any action related to this Agreement will be governed by
Chinese law: "COPYRIGHT LAW OF THE PEOPLE'S REPUBLIC OF CHINA", "PATENT LAW OF
THE PEOPLE'S REPUBLIC OF CHINA", "TRADEMARK LAW OF THE PEOPLE'S REPUBLIC OF
CHINA", "COMPUTER SOFTWARE PROTECTION REGULATIONS OF THE PEOPLE'S REPUBLIC OF
CHINA". No choice of law rules of any jurisdiction will apply."

9. SEVERABILITY. If any provision of this Agreement is held to be
unenforceable, this Agreement will remain in effect with the provision
omitted, unless omission would frustrate the intent of the parties, in which
case this Agreement will immediately terminate.

10. INTEGRATION. This Agreement is the entire agreement between you and
GeneralData relating to its subject matter. It supersedes all prior or
contemporaneous oral or written communications, proposals, representations and
warranties and prevails over any conflicting or additional terms of any quote,
order, acknowledgment, or other communication between the parties relating to
its subject matter during the term of this Agreement. No modification of this
Agreement will be binding, unless in writing and signed by an authorize
depresentative of each party. When the translation document has the different

PRESS <ENTER> TO CONTINUE:
回车继续

meaning or has the conflicting views with Chinese original text conflict,
should take the laws and regulations promulgation unit as well as the
GeneralData issue Chinese original text as the standard.

All trademarks and registered trademarks mentioned herein are the property of
their respective owners.

DO YOU ACCEPT THE TERMS OF THIS LICENSE AGREEMENT? (Y/N): y
接受License,输入y,按回车开始安装。

===============================================================================
Installation Location
---------------------

Choose location for software installation.

Default Install Folder: /opt/GBASE/gbase

ENTER AN ABSOLUTE PATH, OR PRESS <ENTER> TO ACCEPT THE DEFAULT
: /opt/gbase
安装程序提示用户输入GBase 8s的安装路径。我们输入/opt/gbase。

说明:
1./opt目录的默认用户和用户组是root:root,如果被修改成其它用户和用户组,可能会导致安装时,报权限错误。请检查指定的安装路径用户和用户组是否为root:root。
2.如果数据库安装在/opt下,可以不用手动创建后面的目录,安装程序会自动创建。
3.为了保障数据安全,GBase 8s的安装路径,不能允许其它用户有写权限,即安装路径不能设置为777。建议将安装路径的权限设置为755.
4.安装目录中,必须为空。

INSTALL FOLDER IS: /opt/gbase
IS THIS CORRECT? (Y/N): y
输入y,确认安装路径。

===============================================================================
Installation or Distribution
----------------------------

Select the installation type.

Typical: Install the database server with all features and a database server
that
is configured with default values. Includes:
** Client Software Development Kit (CSDK)
** Java Database Connectivity (JDBC)
Minimum disk space required: 700-800MB

Custom: Install the database server with specific features and software that
you need.
Optionally install a configured database server instance.
Minimum disk space required: 75 MB (without a server instance)

->1- Typical installation
2- Custom installation
3- Extract the product files (-DLEGACY option)

ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT:: 1
安装程序支持典型安装和自定义安装方式,我们选择典型安装,所以输入1。

===============================================================================
Server Instance Creation
------------------------

Create a server instance?

->1- Yes - create an instance
2- No - do not create an instance

ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT:: 2
在安装过程中,可以自动创建一个数据库的实例。由于典型安装中创建的实例在配置上非常简单,不适合后期深入的学习GBase 8s,因此我们选择不创建实例,我们在安装后,可以手动执行一个脚本,方便了创建一个新的数据库实例。此处我们输入2。

重要说明:

这个选择很重要。选择不创建实例,不但可以减少你的整体安装时间,也会让你对这款数据库,有更深入地了解。

安装过程中,自动创建一个数据库实例,在个别情况下,可能出现安装后,不能创建数据库现象(执行create database卡住,一段时间后报错退出)。这个问题的原因是sqlhosts文件中使用了机器名,需要我们修改成服务器的IP地址,并重启数据库,就可以解决。也许有其它好的解决方法,不过这是我目前知道的一个方法,而且好用。

===============================================================================
Installation Summary
--------------------

Please review the following before continuing:

Product Name:
GBase Software Bundle

Install Folder:
/opt/gbase

Product Features:
GBase database server,
Base Server,
Extensions and tools,
J/Foundation,
Database extensions,
Conversion and reversion support,
XML publishing,
Demonstration database scripts,
Enterprise Replication,
Data loading utilities,
onunload and onload utilities,
dbload utility,
Backup and Restore,
archecker utility,
ON-Bar utility,
Interface to Tivoli Storage Manager,
Administrative utilities,
Performance monitoring utilities,
Miscellaneous monitoring utilities,
Auditing utilities,
Database import and export utilities,
JSON Client Support,
Global Language Support (GLS),
Chinese

Disk Space Information (for Installation Target):
Required: 496,188,997 Bytes
Available: 12,496,560,128 Bytes

PRESS <ENTER> TO CONTINUE:
安装程序给出一个报告,列出了本次将要安装的数据库组件。按回车将继续安装。

===============================================================================
Ready To Install
----------------
InstallAnywhere is now ready to install GBase Software Bundle onto your system
at the following location:
/opt/gbase
PRESS <ENTER> TO INSTALL:

安装程序再次让用户确认安装程序的位置。我们按回车键,确认安装位置并继续安装。
开始安装…
===============================================================================
Installing...
-------------

[==================|==================|==================|==================]
[------------------|------------------|------------------|------------------]

===============================================================================
Installation Complete
---------------------
Congratulations! GBase Software Bundle installation is complete.
Product install status:

GBase: Successful
GBase Connect: Successful

Main Version: GBase 8s Express Edition

For more information about using GBase products, see the GBase Information
Center at http://www.gbase.cn.

PRESS <ENTER> TO EXIT THE INSTALLER:
安装完成。按回车键退出安装程序。

至此,数据库的组件,全部安装完成。我们再创建一个数据库实例,就可以工作了。

4 创建数据库实例

创建数据库实例,需要切换到gbasedbt用户。

[root@devsvr ~]# su - gbasedbt
在数据库安装目录的etc目录有,有一个GBaseInit_gbasedbt.sh脚本,可以采用向导方式,让我们一步一步,方便地创建一个新的数据库实例。

GBase 8s不同于Oracle,MySQL和SQL Server等,支持在一台服务器上,部署多个实例,听说甚至可以部署不同版本的多个实例,对于那些服务器紧张的小伙伴,是个福利。大家有兴趣,可以自己尝试一下。

[gbasedbt@devsvr ~]$ cd /opt/gbase/etc
[gbasedbt@devsvr etc]$ ls
ac_config.std boot920b.sql evidence.sh revboot1210XC4_CM.sql
alarmprogram.sh boot920c.sql gbasedbtdir-is-insecure secswitch.std
allowed.surrogates.demo boot920.sql GBaseInit_gbasedbt.sh securityconfig.std
blduser.sh boot930a.sql GBase_security.sh securitylog.std
bldutil.sh boot940.sql GLS-cr server_instance_terminal.png
boot1000a.sql bootdwa.sql Glsfiles smi_6to7
boot1000.sql bootupgrade.sql ids_16.png smi_load
boot1110.sql brand idser.xsd smi_unld
boot1150.sql buildsmi ids_master_doc.xml sm_versions.std
boot1150XC6.sql clone ifxdeploy.conf sqlhosts.ext.demo
boot1170.sql cnv10to1110.sql ifx_failover_callback.sh sqlhosts.std
boot1170XC3.sql cnv1150to1170.sql IIF-cr sysadmin
boot1210.sql cnv50t60.sql IIFfiles syscdcv1.sql
boot1210XC4_CM.sql cnv50t92.sql IM_ic_16.png syscdr.sql
boot1210XC4.sql cnv94t100.sql IM_uninstall_16.png syscdrview.sql
boot901.sql conv install sysmaster.sql
boot90.sql convTovNoSQL1210.sql jsonListener-example.properties sysuser.sql
boot910b.sql convTovNoSQL1210XC3.sql log_full.sh sysutils.sql
boot910.sql cvtlongid7x.sql make-gbasedbtdir-secure termcap
boot911.sql cvtlongid914.sql Messagefiles typetab
boot911u.sql cvtviotab.sql MSG-cr xpg4_is.sql
boot912b.sql do_role_sep no_log.sh
boot912.sql dropcdr.sql onconfig.std
boot920a.sql dummyupds100.sql release_notes.png

执行创建实例的脚本
[gbasedbt@devsvr etc]$ sh GBaseInit_gbasedbt.sh

开始创建数据库实例
Initializing Program...OK
ENTER THE INSTANCE INFORMATION or PRESS <ENTER> TO ACCEPT THE DEFAULT.
ENTER GBASE INSTANCE NAME (GBASEDBTSERVER) [Default:gbaseserver]:
脚本默认的实例名称为gbaseserver,可以在冒号后面输入我们希望的名称,也可以直接回车,使用默认的实例名。
说明:实例的名称可以是字母,数字和下划线。不要用减号,不要用减号,不要用减号。

GBASE INSTALL FOLDER LIST:
1) /opt/gbase
CHOOSE GBASE INSTALL FOLDER(GBASEDBTDIR) [Default:/opt/gbase]:
安装脚本询问GBase 8s的程序安装在哪个路径下,默认是我们之前安装时指定的路径。我们直接回车继续。

CHOOSE SERVICE IP ADDRESS FROM THE LIST:
1) 192.168.3.8
2) 127.0.0.1
3) 192.168.122.1
ENTER THE NUMBER FOR YOUR CHOICE [Default:192.168.3.8]:
安装脚本询问我们服务器的IP地址,我们输入服务器的IP地址。如果默认的IP地址是我们希望的IP,直接回车继续。

SPECIFY THE PORT NUMBER FOR GBASE [Default:9088]:
安装脚本询问我们数据库监听使用的端口号,默认为9088。我们使用默认值,回车继续。

INITIALIZE TYPE:
1) TYPICAL -- Initialize the instance with all features configured with default values.
2) CUSTOM -- Initialize the instance with specific features that you need.
ENTER THE NUMBER FOR YOUR CHOICE [Default:1]: 2
安装脚本询问我们初始化的类型,我们选择CUSTOM,输入2,回车继续。

GBASE CHARACTER SET LIST:
1) en_US.8859-1
2) zh_CN.GB18030-2000
3) zh_CN.utf8
ENTER THE NUMBER FOR YOUR CHOICE [Default:1]: 3
安装脚本询问我们数据库使用哪种字符集,我们使用UTF8,输入3,回车继续。

ENTER THE DATA SPACE PATH [Default:/opt/gbase/gbaseserver_dbs]:
安装脚本询问我们数据保存在哪个目录中,我们使用默认值,回车继续。

ENTER THE LOGICAL LOG DBSPACE SIZE(MB) [Default:1150]: 200
安装脚本询问我们,保存逻辑日志的数据库空间大小,我们输入200,回车继续。
说明:这个地方指定的值很大时,数据库会按该值分配磁盘空间,可能用时较长。

ENTER THE PHYSICAL LOG DBSPACE SIZE(MB) [Default:1150]: 200
安装脚本询问我们,保存物理日志的数据库空间大小,我们输入200,回车继续。
说明:这个地方指定的值很大时,数据库会按该值分配磁盘空间,可能用时较长。

ENTER THE SMART LOB DBSPACE SIZE(MB) [Default:260]: 100
安装脚本询问我们,保存智能大对象的数据库空间大小,我们输入100,回车继续。
说明:这个地方指定的值很大时,数据库会按该值分配磁盘空间,可能用时较长。

ENTER THE TEMPORARY DBSPACE SIZE(MB) [Default:260]: 100
安装脚本询问我们,保存临时数据的数据库空间大小,我们输入100,回车继续。
说明:这个地方指定的值很大时,数据库会按该值分配磁盘空间,可能用时较长。

ENTER "Y" TO START DATABASE ADVANCED SETTINGS, OR ENTER "N" TO ACCEPT DEFAULT VALUES: [Default:N]: y
安装脚本询问我们,是否进行一些高级设置,我们输入y,回车继续。

ENTER THE NUMBER OF DATA DBSPACES [Default:1]: 5
安装脚本询问我们,创建几个保存数据的数据库空间,我们输入5,回车继续。
提示:这点很重要,方便我们后面学习分片表。

ENTER THE NUMBER OF TEMP DBSPACES [Default:1]: 3
安装脚本询问我们,创建几个保存临时数据的数据库空间,我们输入3,回车继续。

Enter "Y" TO ENABLE ENVIRONMENT GL_USEGLU, OR ENTER "N" TO DISABLE: [Default:N]:
安装脚本询问我们,是否启用GL_USEGLU,默认不启用,我们直接回车继续。

INSTANCE SUMMARY:
Instance name: gbaseserver
GBase install directory: /opt/gbase
IP address & port: 192.168.3.8:9088
Character set: zh_CN.utf8
Logical log space size: 200 MB
Physical log space size: 200 MB
Smart LOB space size: 100 MB
Temp DBSpace size: 100 MB
Data path: /opt/gbase/gbaseserver_dbs
Data path free size: 11448 MB
The number of data DBSpace: 5
The number of temp DBSpace: 3
Environment GL_USEGLU: 0

Enter "Y" to Start database initializing, or Enter "N" to Edit Again: y
安装脚本列出创建实例的配置信息。我们输入y,回车继续。
安装脚本开始创建实例。

Touching Chunks...OK
Create sqlhosts File: /opt/gbase/etc/sqlhosts.gbaseserver ...OK
Setting Parameters in /opt/gbase/etc/onconfig.gbaseserver :
EADS.OFF_RECVRY_THREADS.USELASTCOMMITTED.SHMVIRTSIZE.SHMADD.GBASEDBTCONTIME.BUFFERPOOL2K.BUFFERPOOL16K...AUTO_CKPTS.OK
Initializing Root DBSpace & Share Memory...OK
Creating system database.........OK
Creating logical log Dbspace...OK
Creating physical log Dbspace...OK
Creating smart LOB Dbspace...OK
Creating temp Dbspace.1.2.3...OK
Creating data Dbspace.1.2.3.4.5...OK
Setting dbscheduler...OK
Moving physical log...OK
Adding 20 logical logs: 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20...OK
Setting data chunks extendable...OK
Cleaning logical logs in rootdbs...Your evaluation license will expire on 2022-06-17 00:00:00
.Your evaluation license will expire on 2022-06-17 00:00:00
.Your evaluation license will expire on 2022-06-17 00:00:00
.Your evaluation license will expire on 2022-06-17 00:00:00
...OK
Database restarting.......Your evaluation license will expire on 2022-06-17 00:00:00
OK
Creating database: gbasedb...OK

Now you can use this URL to connect to gbasedb:
jdbc:gbasedbt-sqli://192.168.3.8:9088/gbasedb:GBASEDBTSERVER=gbaseserver;DB_LOCALE=zh_CN.utf8;CLIENT_LOCALE=zh_CN.utf8;NEWCODESET=UTF8,utf8,57372;

Version:
Your evaluation license will expire on 2022-06-17 00:00:00
On-Line -- Up 00:00:13 -- 597864 Kbytes
Build Number: 3.3.0_N303

GBase Initializing Finished!

Initialize log file : ./InitGBaseDB_202106171446.log

Press <ENTER> to Exit and Logout...

Killed
至此,数据库实例创建完成。

5 环境变量

安装脚本会在gbasedbt的Home路径下,自动生成一个名称为profile.gbaseserver的文件,记录了新创建数据库实例需要的环境变量。
[gbasedbt@devsvr ~]$ ls
profile.gbaseserver

cat命令查看文件的内容
[gbasedbt@devsvr ~]$ cat profile.gbaseserver
export GBASEDBTSERVER=gbaseserver
export GBASEDBTDIR=/opt/gbase
export GBASEDBTSQLHOSTS=/opt/gbase/etc/sqlhosts.gbaseserver
export ONCONFIG=onconfig.gbaseserver
export PATH=/opt/gbase/bin:$PATH
export DB_LOCALE=zh_CN.utf8
export CLIENT_LOCALE=zh_CN.utf8
unset GL_USEGLU

可以使用source命令,使环境变量生效
[gbasedbt@devsvr ~]$ source profile.gbaseserver

可以使用env查看环境变量。
[gbasedbt@devsvr ~]$ env | grep GBASE
GBASEDBTSQLHOSTS=/opt/gbase/etc/sqlhosts.gbaseserver
GBASEDBTSERVER=gbaseserver
GBASEDBTDIR=/opt/gbase

6 数据库状态查看与启停

—6.1 查看GBase 8s的进程信息

GBase 8s启动后,会运行名称为oninit的进程,可以使用ps命令查看。
[gbasedbt@devsvr ~]$ ps -ef | grep oninit
root 6129 113595 0 14:48 ? 00:00:00 oninit -v
root 6466 113595 0 14:48 ? 00:00:00 oninit -v
root 6799 113595 0 14:48 ? 00:00:00 oninit -v
root 7130 113595 0 14:48 ? 00:00:00 oninit -v
root 7467 113595 0 14:48 ? 00:00:00 oninit -v
gbasedbt 108544 1 1 14:48 ? 00:00:00 oninit -v
root 113595 108544 0 14:48 ? 00:00:00 oninit -v
root 113624 113595 0 14:48 ? 00:00:00 oninit -v
gbasedbt 115434 67969 0 14:48 pts/1 00:00:00 grep --color=auto oninit
root 116823 113595 0 14:48 ? 00:00:00 oninit -v
root 120139 113595 0 14:48 ? 00:00:00 oninit -v
root 123437 113595 0 14:48 ? 00:00:00 oninit -v
root 126761 113595 0 14:48 ? 00:00:00 oninit -v
gbasedbt 130082 113595 0 14:48 ? 00:00:00 oninit -v

—6.2 查看数据库运行状态

可以使用onstat命令,查看数据库运行状态。
[gbasedbt@devsvr ~]$ onstat -
Your evaluation license will expire on 2022-06-17 00:00:00
On-Line -- Up 00:01:34 -- 597864 Kbytes
命令输出显示,当前数据库运行在OnLine状态。

—6.3 启动数据库

可以使用oninit命令启动数据库。
[gbasedbt@devsvr ~]$ oninit -vy
Your evaluation license will expire on 2022-06-17 00:00:00
Reading configuration file '/opt/gbase/etc/onconfig.gbaseserver'...succeeded
Creating /GBASEDBTTMP/.infxdirs...succeeded
Allocating and attaching to shared memory...succeeded
Creating resident pool 36470 kbytes...succeeded
Creating infos file "/opt/gbase/etc/.infos.gbaseserver"...succeeded
Linking conf file "/opt/gbase/etc/.conf.gbaseserver"...succeeded
Initializing rhead structure...rhlock_t 65536 (2048K)... rlock_t (26562K)... 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 32 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@devsvr ~]$

启动完成后,可以使用onstat命令查看数据库的运行状态。
[gbasedbt@devsvr ~]$ onstat -
Your evaluation license will expire on 2022-06-17 00:00:00
On-Line -- Up 00:00:21 -- 597864 Kbytes

可以使用ps命令,查看操作系统的进程,是否存在oninit进程。
[gbasedbt@devsvr ~]$ ps -ef | grep oninit
root 347 117913 0 14:52 ? 00:00:00 oninit -vy
gbasedbt 3818 117913 0 14:52 ? 00:00:00 oninit -vy
root 10443 117913 0 14:52 ? 00:00:00 oninit -vy
root 10775 117913 0 14:52 ? 00:00:00 oninit -vy
root 11101 117913 0 14:52 ? 00:00:00 oninit -vy
root 11439 117913 0 14:52 ? 00:00:00 oninit -vy
root 11775 117913 0 14:52 ? 00:00:00 oninit -vy
gbasedbt 77493 67969 0 14:52 pts/1 00:00:00 grep --color=auto oninit
gbasedbt 112913 1 2 14:52 ? 00:00:00 oninit -vy
root 117913 112913 0 14:52 ? 00:00:00 oninit -vy
root 117945 117913 0 14:52 ? 00:00:00 oninit -vy
root 121156 117913 0 14:52 ? 00:00:00 oninit -vy
root 124481 117913 0 14:52 ? 00:00:00 oninit -vy
root 127810 117913 0 14:52 ? 00:00:00 oninit -vy

—6.4 停止数据库

可以使用onmode命令,停止数据库的运行。
[gbasedbt@devsvr ~]$ onmode -ky
Your evaluation license will expire on 2022-06-17 00:00:00
使用onstat命令查看数据库状态,显示共享内存没有初始化,数据库处于离线状态。
[gbasedbt@devsvr ~]$ onstat -
Your evaluation license will expire on 2022-06-17 00:00:00
shared memory not initialized for GBASEDBTSERVER 'gbaseserver'
使用ps命令查看数据库的进程信息,发现没有oninit进程存在。
[gbasedbt@devsvr ~]$ ps -ef | grep oninit
gbasedbt 88853 67969 0 14:52 pts/1 00:00:00 grep --color=auto oninit

—6.5 验证数据库安装

可以使用客户端工具,验证数据库功能是否正常。
[gbasedbt@devsvr ~]$ dbaccess - -
Your evaluation license will expire on 2022-06-17 00:00:00
> create database mydb with log;

Database created.

> database mydb;

Database closed.

Database selected.

> create table t_user(f_userid int, f_username varchar(50));

Table created.

> insert into t_user values(1,'gbasedbt');

1 row(s) inserted.

> select * from t_user;

f_userid f_username

1 gbasedbt

1 row(s) retrieved.

>

Database closed.

[gbasedbt@devsvr ~]$

7 卸载 GBase 8s

—7.1 卸载GBase 8s数据库组件与数据

GBase 8s提供了一个卸载程序,用于GBase 8s数据库的卸载。

进入卸载程序的目录
[root@devsvr ~]# cd /opt/gbase/uninstall/uninstall_ids/
[root@devsvr uninstall_ids]# ls
InstallScript.iap_xml installvariables.properties removablesList.txt uninstaller.jar uninstallids uninstallids.lax

启动卸载程序,开始卸载GBase 8s
[root@devsvr uninstall_ids]# ./uninstallids
===============================================================================
GBase Software Bundle (created with InstallAnywhere)
-------------------------------------------------------------------------------

Preparing CONSOLE Mode Uninstallation...

 

===============================================================================
Uninstall GBase Software Bundle
-------------------------------

About to uninstall GBase Software Bundle.

In this uninstall process, all GBase Software Bundle products in /opt/gbase
will be uninstalled.
It is recommended that you first shutdown all database server instances related
to this installation prior to uninstalling the product.

PRESS <ENTER> TO CONTINUE:
回车确认
===============================================================================
Server Uninstall Options
------------------------

Server action:

Important: Choosing to remove all databases will remove all database chunks,
environment files, registry entries, and message log files for all database
server instances associated with this installation.

->1- Retains all databases, but removes all server binaries
2- Removes server binaries and all databases associated with them

ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT:: 2
我们需要删除GBase 8s数据库组件和全部的数据库,输入2并回车。

卸载程序开始运行
===============================================================================
Uninstalling...
---------------

...*
*
*************************
*************************
*************************
************************
...*
*
*************************
*************************
*************************
************************
...*
*
*************************
*************************
*************************
************************
...*
*
*************************
*************************
*************************
*************************

===============================================================================
Uninstall Complete
------------------

Uninstall is complete for GBase Software Bundle.

Product uninstall status:
GBase: Successful
GBase 8s数据库卸载成功。

—7.2 清除残余的目录

由于卸载程序在GBase 8s的安装目录中,因此卸载程序并没有完成清空安装目录,需要我们手动清除。
[root@devsvr uninstall_ids]# cd /opt
[root@devsvr opt]# ls
gbase rh
[root@devsvr opt]# rm -rf gbase

—7.3 删除gbasedbt用户

执行userdel,删除用户。
[root@devsvr ~]# userdel -r gbasedbt
检查确认用户和组是否删除。
[root@devsvr ~]# cat /etc/passwd | grep gbasedbt
[root@devsvr ~]# cat /etc/group | grep gbasedbt
至此,GBase 8s 卸载完成

 

赞(0)
MySQL学习笔记 » 第2章:GBase 8s 安装与卸载