当数据库非正常状态关闭时,再次通过oninit –vy启动数据库,会发生如下错误。
Warning: Parameter's user-configured value was adjusted. (DS_MAX_SCANS) Warning: Parameter's user-configured value was adjusted. (ONLIDX_MAXMEM) oninit: Fatal error in shared memory creation Reading configuration file '/opt/database/etc/onconfig.ol_gbasedbt1210'...succeeded Creating /GBASEDBTTMP/.infxdirs...succeeded Allocating and attaching to shared memory...FAILED WARNING: server initialization failed or timed out. Check the message log, online.log, for errors. |
这说明一些系统资源被占用,数据库无法正常启动。
此时需要通过onclean -ky命令尝试清除这些资源,但是有时仍然无法清除干净。
我们需要通过ips进行查看
------ Shared Memory Segments -------- key shmid owner perms bytes nattch status 0x00000000 98304 root 600 393216 2 dest 0x00000000 131073 root 600 393216 2 dest 0x00000000 163842 root 600 393216 2 dest 0x00000000 196611 root 600 393216 2 dest 0x00000000 229380 root 600 393216 2 dest 0x00000000 262149 root 600 393216 2 dest 0x00000000 294918 root 600 393216 2 dest 0x00000000 327687 root 600 393216 2 dest 0x00000000 360456 root 600 393216 2 dest 0x00000000 393225 root 600 393216 2 dest 0x00000000 425994 root 600 393216 2 dest 0x00000000 458763 root 600 393216 2 dest 0x00000000 491532 root 600 393216 2 dest 0x00000000 524301 root 600 393216 2 dest 0x00000000 557070 root 600 393216 2 dest 0x52564801 884751 root 660 9048064 8 0x52564802 917520 root 660 103809024 8 0x52564803 950289 root 660 67108864 8 0x00000000 688146 root 600 393216 2 dest 0x00000000 720915 root 600 393216 2 dest 0x00000000 753684 root 600 393216 2 dest ------ Semaphore Arrays -------- key semid owner perms nsems 0x00000000 0 root 600 1 0x00000000 65537 root 600 1 0x00000000 294914 root 660 4 0x00000000 327683 root 660 1 0x00000000 360452 root 660 1 0x00000000 393221 root 660 1 0x00000000 425990 root 660 1 0x00000000 458759 root 660 4 0x00000000 491528 root 660 1 0x00000000 524297 root 660 1 0x00000000 557066 root 660 1 0x00000000 589835 root 660 1 |
并通过ipcrm shmid 的方式逐项进行移除
如果其中没有其它应用的资源,我们可以通过执行下列命令进行快速清除。
ipcs -m|awk ' /^0x/{print $2}'|while read line;do ipcrm -m $line;done
echo 3 > /proc/sys/vm/drop_caches