SinoDB数据库安装后产生的目录及其文件,都有相对于的属组及权限,若是把文件的属组或权限修改了,可能会产生一系列的问题,例如数据库无法启动、某些指令无法执行。
SinoDB数据库文件的属组或权限被修改的原因是多种的,可能是因为安全加固的需要导致了误修改或者是运维人员的误操作,以下通过例子说明oninit属组被修改后,导致无法启动数据库。
- 1.正常的oninit文件属组及权限如下:
[root@node31 bin]# ls -lrt oninit
-rwsr-sr-- 1 root sinodbms 27114289 Sep 17 22:52 oninit
- 2.修改oninit文件属组,此时我们可以看到,文件的权限也被修改
[root@node31 bin]# chown sinodbms:sinodbms oninit
[root@node31 bin]# ls -lrt oninit
-rwxr-xr-- 1 sinodbms sinodbms 27114289 Sep 17 22:52 oninit
- 3.切换到sinodbms启动数据库报错:
[root@node31 bin]# su - sinodbms
Last login: Wed Nov 1 05:04:00 EDT 2023 on pts/0
[sinodbms@node31 ~]$ oninit -v
05:05:55 The number of file descriptors is limited by your shell
Reading configuration file ‘/home/sinodbms/etc/onconfig.sinodb0918’…succeeded
Allocating and attaching to shared memory…succeeded
Creating resident pool 4310 kbytes…succeeded
Creating infos file “/home/sinodbms/etc/.infos.sinodb0918”…succeeded
Linking conf file “/home/sinodbms/etc/.conf.sinodb0918”…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
Initializing encryption-at-rest if necessary…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…FAILED
oninit: Fatal error in shared memory initialization
WARNING: server initialization failed or timed out.
Check the message log, online.log, for errors.
[sinodbms@node31 ~]$ onstat -m
shared memory not initialized for SINODBMSSERVER ‘sinodb0918’
Message Log File: /home/sinodbms/tmp/online.log
05:05:57 Event alarms enabled. ALARMPROG = ‘/home/sinodbms/etc/alarmprogram.sh’
05:05:57 Booting Language from module <>
05:05:57 Loading Module
05:05:57 Booting Language from module <>
05:05:57 Loading Module
05:06:02 initSecurityEvent: 0
05:06:02 DR: DRAUTO is 0 (Off)
05:06:02 DR: ENCRYPT_HDR is 0 (HDR encryption Disabled)
05:06:02 Event notification facility epoll enabled.
05:06:02 CCFLAGS2 value set to 0x200
05:06:02 SQL_FEAT_CTRL value set to 0x8008
05:06:02 SQL_DEF_CTRL value set to 0x4b0
05:06:02 Sinoregal SinoDB Dynamic Server Version 16.8.FC8U0X3 Software Serial Number AAA#B000000
05:06:02 The chunk ‘/home/sinodbms/chunks/rootdbs’ must have READ/WRITE permissions for owner (600).
05:06:02 oninit: Fatal error in shared memory initialization
05:06:02 Sinoregal SinoDB Dynamic Server Stopped.
05:06:02 Process exited with return code 126: /bin/sh /bin/sh -c /home/sinodbms/etc/alarmprogram.sh 4 7 “Dynamic Server Initialization failure.” “The chunk ‘/home/sinodbms/chunks/rootdbs’ must have READ/WRITE permissions for owner (600).” “” 7018
05:06:02 mt_shm_remove: WARNING: may not have removed all/correct segments
- 4.日志中提示The chunk ‘/home/sinodbms/chunks/rootdbs’ must have READ/WRITE permissions for owner (600).然而查看该文件的权限,实际上是没问题的。
[sinodbms@node31 ~]$ ls -lrt /home/sinodbms/chunks/rootdbs
-rw-rw---- 1 sinodbms sinodbms 307200000 Nov 1 05:04 /home/sinodbms/chunks/rootdbs
[sinodbms@node31 ~]$
- 5.切换到root用户,把oninit文件的属组修改成正常的值
[sinodbms@node31 ~]$ exit
logout
[root@node31 bin]# pwd
/home/sinodbms/bin
[root@node31 bin]# ls -lrt oninit
-rwxr-xr-- 1 sinodbms sinodbms 27114289 Sep 17 22:52 oninit
[root@node31 bin]# chown root:sinodbms oninit
[root@node31 bin]# chmod 6754 oninit
[root@node31 bin]# ls -lrt oninit
-rwsr-sr-- 1 root sinodbms 27114289 Sep 17 22:52 oninit
- 6.切换到sinodbms用户,正常启动数据库
[root@node31 bin]# su - sinodbms
Last login: Wed Nov 1 05:05:51 EDT 2023 on pts/1
[sinodbms@node31 ~]$ oninit -v
Reading configuration file ‘/home/sinodbms/etc/onconfig.sinodb0918’…succeeded
Creating /SINODBMSTMP/.infxdirs…succeeded
Allocating and attaching to shared memory…succeeded
Creating resident pool 4310 kbytes…succeeded
Creating infos file “/home/sinodbms/etc/.infos.sinodb0918”…succeeded
Linking conf file “/home/sinodbms/etc/.conf.sinodb0918”…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
Initializing encryption-at-rest if necessary…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 onmode_mon thread…succeeded
Creating periodic thread…succeeded
Creating VP cache drain thread…succeeded
Creating limits manager thread…succeeded
Starting scheduling system…succeeded
Verbose output complete: mode = 5
[sinodbms@node31 ~]$ onstat -
Sinoregal SinoDB Dynamic Server Version 16.8.FC8U0X3 – On-Line – Up 00:01:06 – 148084 Kbytes
[sinodbms@node31 ~]$