Linux下,Oracle 11g的自动内存管理不能指定大于这个/dev/shm的总量内存。否则就会出现如下错误
ORA-00845: MEMORY_TARGET not supported on this system
Linux环境下,挂载点 /dev/shm默认是系统内存的50%。根据Oracle的安装手册,需要手工指定 /dev/shm的空间大小,以便自动内存管理可以使用更多的内存。
最近wait4friend在一台CentOS6.2的VM上,修改/dev/shm之后出现问题,现象是系统重启后这个配置总是回复成默认值。整个过程如下
[root@centos01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_centos00-lv_root
14G 11G 2.6G 80% /
tmpfs 1.9G 88K 1.9G 1% /dev/shm
/dev/sda1 485M 37M 424M 8% /boot
[root@centos01 ~]# cat /etc/fstab
/dev/mapper/vg_centos00-lv_root / ext4 defaults 1 1
UUID=3f3c551e-902d-46f6-9b93-0430c175421d /boot ext4 defaults 1 2
/dev/mapper/vg_centos00-lv_swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults,size=3276M 0 0
[root@centos01 ~]# fuser -km /dev/shm
/dev/shm: 2136m
[root@centos01 ~]# umount /dev/shm
[root@centos01 ~]# mount /dev/shm
[root@centos01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_centos00-lv_root
14G 11G 2.6G 80% /
/dev/sda1 485M 37M 424M 8% /boot
tmpfs 3.2G 0 3.2G 0% /dev/shm
[root@centos01 ~]# reboot
[root@centos01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_centos00-lv_root
14G 11G 2.6G 80% /
tmpfs 1.9G 88K 1.9G 1% /dev/shm
/dev/sda1 485M 37M 424M 8% /boot
[root@centos01 ~]# cat /etc/fstab
tmpfs /dev/shm tmpfs defaults,size=3276M 0 0
并且/etc/mtab的记录信息也是匹配的
[root@centos01 ~]# cat /etc/mtab
/dev/mapper/vg_centos00-lv_root / ext4 rw 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs rw,size=3276M 0 0
/dev/sda1 /boot ext4 rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0
[root@centos01 ~]# vi /etc/rc.local
"/etc/rc.local" 11L, 274C#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
mount -o remount /dev/shm
重新启动之后,问题解决。