Skip to content

适用虚谷数据库版本

v12.9



适用虚谷数据库版本

v12.9


启动和停止数据库

📄字数 2.0K
👁️阅读量 加载中...

启动数据库

XuguDB 提供以下两种方式启动数据库:

  • 命令行启动
  • 自动化脚本启动

命令行启动数据库

XuguDB 提供的产品包里找到BIN目录下的数据库可执行程序,可直接执行该程序,亦可根据绝对或相对路径进行启动,后缀命令可跟--child--service,区别在于--child为前台启动,--service为后台启动。

  • 示例
shell
[xugu@kunqian236 BIN]$ ./xugu_linux_x86_64_20250327 --child
XuguDB 12.0.0 (Built:2025-03-27 12:00:00 GA)
Start at: 2025-06-24 15:38:17
database server PID=34864
CPU info:
	Node 0: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
	Node 1: 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
Resource limit:
	File number:     hard limit=10240,soft limit=10240
	File size(M):    hard limit=-1,soft limit=-1
	Data memory(M):  hard limit=-1,soft limit=-1
	Resident(M):     hard limit=-1,soft limit=-1
	Proc's total memory(M): hard limit=-1,soft limit=-1
Open file cluster.ini failed.
Loading license ... failed!
init data buffer...ok.
Perform control file checksum...ok.
Trial Edition,remain 360 days
open all tablespaces...ok.
Load all local stores...ok.
Load all gstores...ok.
Mount all gstore...ok.
Open all system tables...ok
Open all system views...ok
Load all jobs...ok
All service started.
Listening at port 5138

注意

XuguDB 还提供其他参数供启动时使用,详情可参考 数据库启动参数

自动化脚本启动数据库

解压后可在 BIN 目录下查看到startdb.sh脚本,执行此脚本则立即启动数据库:

  • 示例
shell
-- 查看 startdb.sh 脚本
[xugu@kunqian236 BIN]$ cat startdb.sh
#!/usr/bin/bash

echo "当前脚本支持终端启动,其它方式启动参考数据库使用文档"

chmod +x xugu_linux_x86_64_20250327
$PWD/xugu_linux_x86_64_20250327 --child


-- 执行 startdb.sh 脚本
[xugu@kunqian236 BIN]$ ./startdb.sh 
当前脚本支持终端启动,其它方式启动参考数据库使用文档
XuguDB 12.0.0 (Built:2025-03-27 12:00:00 GA)
Start at: 2025-06-24 15:43:26
database server PID=56169
CPU info:
	Node 0: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
	Node 1: 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
Resource limit:
	File number:     hard limit=10240,soft limit=10240
	File size(M):    hard limit=-1,soft limit=-1
	Data memory(M):  hard limit=-1,soft limit=-1
	Resident(M):     hard limit=-1,soft limit=-1
	Proc's total memory(M): hard limit=-1,soft limit=-1
Open file cluster.ini failed.
Loading license ... failed!
init data buffer...ok.
Perform control file checksum...ok.
Trial Edition,remain 360 days
open all tablespaces...ok.
Load all local stores...ok.
Load all gstores...ok.
Mount all gstore...ok.
Open all system tables...ok
Open all system views...ok
Load all jobs...ok
All service started.
Listening at port 5138

提示

用户可自行修改该脚本(如child改成service),设置数据库启动方式。

停止数据库

若需停止数据库服务,可执行以下命令:

sql
SQL> SHUTDOWN;

提示

在数据库仍有连接访问的情况下,可执行 SHUTDOWN IMMEDIATE 强制断开数据库连接以停止数据库服务。