1,执行数据库初始化或者启动数据库时,报
“Allocating and attaching to shared memory…FAILED
WARNING: server initialization failed or timed out.
Check the message log, online.log, for errors.”
解析:出现问题,根据提示要求查看online.log,使用onstat -m命令可查看最近20行online.log日志信息。如果日志里包含类似以下信息
“19:03:42 shmget: [EEXIST][17]: key 52564801: shared memory already exists
19:03:42 mt_shm_init: can’t create resident segment”,
表示数据库的内存段已经被占用,可能的情况是:
1)当前实例已经启动,即通过onstat -命令检查状态,如果已经是On-Line状态,即“GBase Database Server Version 12.10.FC4G1AEE – On-Line – Up 00:07:02 – 208516 Kbytes”
表示数据库不需要再初始化或者重新启动,保持现有状态即可。
2)当前实例未启动,即通过onstat -命令检查状态,如果已经是未启动状态,即“shared memory not initialized for GBASEDBTSERVER ‘ol_gbasedbt1210’”
则表示之前的数据库关闭或者异常时,内存未能及时释放,执行onclean -ky命令强制清理内存,然后通过ipcs -m命令查看key中与报错信息中一致的0x52564801是否存在,如果不存在,可以重新启动数据库实例;如果存在,使用root用户执行ipcrm -M 0x52564801清理共享内存,同时清理0x525648XX 开头各个内存段,完成后可以重新启动数据库实例。
2,执行数据库初始化或者启动数据库时,报
“Opening primary chunks…FAILED
oninit: Fatal error in shared memory initialization
WARNING: server initialization failed or timed out.
Check the message log, online.log, for errors. ”
解析:出现问题,根据提示要求查看online.log,使用onstat -m命令可查看最近20行online.log日志信息。如果日志里包含类似以下信息:
1)“19:07:08 The chunk ‘/opt/gbase/storage/rootdbs’ must have READ/WRITE permissions for owner and group (660).”
表示数据库使用的chunk对应的文件或者文件系统权限不对,按提示要求修改为属主及属组均为gbasbedbt,权限为660(即:chown gbasedbt:gbasedbt /opt/gbase/storage/rootdbs , chmod 660 /opt/gbase/storage/rootdbs),完成后重新启动数据库。
2)“19:10:51 The chunk ‘/opt/gbase/storage/rootdbs’ must have READ/WRITE permissions for owner (600).”
数据库使用的chunk对应的文件或者文件系统权限应为属主及属组均为gbasbedbt,权限为660,这里提示需要600权限。说明oninit可执行文件的属主及权限不对,或者是非root用户安装的数据库。我们要求使用root用户来安装数据库。故在$GBASEDBTDIR目录下,使用root用户执行RUNasroot.installserver脚本以完成对所有已安装的文件的权限修正。同时修改chunk文件或者文件系统的属主及属组均为gbasbedbt,权限为660(即:chown gbasedbt:gbasedbt /opt/gbase/storage/rootdbs , chmod 660 /opt/gbase/storage/rootdbs),完成后重新初始化实例或者重启实例。




