问题描述:
接到同事电话,在一个演示环境的数据库启动时候出现如下错误:
[oracle@node6 bin]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Mar 21 23:21:43 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORA-27125: unable to create shared memory segment
Linux-x86_64 Error: 1: Operation not permitted
用oracle用户登录查看当前用户的环境变量设置:
[oracle@node6 ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=$ORACLE_BASE/10g
export ORACLE_SID=sch206
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
看到当前oracle用户的base目录和家目录的位置,且oracle用户默认的实例id为sch206
先查看当前实例名称:
[oracle@node6 ~]$ echo $ORACLE_SID
sch206
查看oracle用户相关权限
[oracle@node6 ~]$ more /etc/passwd|grep oracle
oracle:x:500:500::/home/oracle:/bin/bash
由上面可以看出oracle用户的家目录是/home/oracle
验证一下用户的家目录
[oracle@node6 ~]$ pwd
/home/oracle
查看oracle软件的HOME目录:
[oracle@node6 ~]$ echo $ORACLE_HOME
/u01/oracle/10g
去到命令目录下
[oracle@node6 ~]$ cd /u01/oracle/10g/
[oracle@node6 10g]$ cd bin/
[oracle@node6 bin]$
[oracle@node6 bin]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Mar 21 23:21:43 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORA-27125: unable to create shared memory segment
Linux-x86_64 Error: 1: Operation not permitted
SQL> exit
核实了问题确实出现:
通过网络查询
hugetlb_shm_group contains group id that is allowed to create SysV shared memory segment using hugetlb page. When a process uses some memory, the CPU is marking the RAM as used by that process. For efficiency, the CPU allocate RAM by chunks of 4K bytes (it's the default value on many platforms). Those chunks are named pages. Those pages can be swapped to disk, etc.
Since the process address space are virtual, the CPU and the operating system have to remember which page belong to which process, and where it is stored. Obviously, the more pages you have, the more time it takes to find where the memory is mapped. When a process uses 1GB of memory, that's 262144 entries to look up (1GB / 4K). If one Page Table Entry consume 8bytes, that's 2MB (262144 * 8) to look-up.
Most current CPU architectures support bigger pages (so the CPU/OS have less entries to look-up), those are named Huge pages (on Linux), Super Pages (on BSD) or Large Pages (on Windows), but it all the same thing.
查询了一下,发现问题和linux上的hugetbl有关。这里反复提到了HugePage。
[oracle@node6 bin]$ exit
Logout
退出oracle用户
得出解决办法:
[oracle@node6 ~]$ more /proc/sys/vm/hugetlb_shm_group
0
[oracle@node6 ~]$ echo 500 >>/proc/sys/vm/hugetlb_shm_group
-bash: /proc/sys/vm/hugetlb_shm_group: 权限不够
[oracle@node6 ~]$ exit
logout
[root@node6 ~]# id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
[root@node6 ~]# id oracle
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),502(dba)
[root@node6 ~]# echo 500 >>/proc/sys/vm/p
page-cluster panic_on_oom percpu_pagelist_fraction
将groups组追加到内核中
[root@node6 ~]# echo 500 >>/proc/sys/vm/hugetlb_shm_group
[root@node6 ~]# su - oracle
[oracle@node6 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Mar 21 23:23:43 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORACLE instance started.
Total System Global Area 2147483648 bytes
Fixed Size 2022144 bytes
Variable Size 503317760 bytes
Database Buffers 1627389952 bytes
Redo Buffers 14753792 bytes
Database mounted.
Database opened.
[oracle@node6 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Mar 21 23:25:28 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> show parameter log_archive_start
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_start boolean FALSE
SQL> alter system reset log_archive_start scope=spfile sid='*';
System altered.
//重置一下日志。
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
//关闭数据库
SQL> startup
ORACLE instance started.
Total System Global Area 2147483648 bytes
Fixed Size 2022144 bytes
Variable Size 503317760 bytes
Database Buffers 1627389952 bytes
Redo Buffers 14753792 bytes
Database mounted.
Database opened.
//数据库启动了。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/23141985/viewspace-719197/ ,如需转载,请注明出处,否则将追究法律责任。