/dev/shm对Oracle 11g的影响:
ORACLE 从11g版本开始,引入了一个自动内存管理(Automatic Memory Management)特性,该特性需要更多的共享内存(/dev/shm),因此如果决定应用该特性的话, 必须要确保共享内存大于ORACLE 中初始化参数MEMORY_MAX_TARGET 和MEMORY_TARGET(特别提示,这两个参数即自动内存管理特性对应的初始化参数)的值。
如果在初始化参数中设置了MEMORY_MAX_TARGET 和MEMORY_TARGET 两参数为非0值,并且不符合系统共享内存,则ORACLE 数据库启动时,就会触发ORA-00845:MEMORY_TARGET not supported on this system 错误。
Oracle 11g的Linux版本在修改了MEMORY_TARGET或者SGA_TARGET后启动可能会报错:
SQL> shutdown immediate
Database closed.
SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system
在数据库的alert日志中将有下面的报错:
Starting ORACLE instance (normal)
WARNING: You are trying to use the MEMORY_TARGET feature. This feature requires the /dev/shm file system to be mounted for at least 10536091648 bytes. /dev/shm is either not mounted or is mounted with available space less than this size. Please fix this so that MEMORY_TARGET can work as expected. Current available is 8589852672 and used is 81920 bytes.
memory_target needs larger /dev/shm
问题很明显:是因为/dev/shm的可用空间(非shm的总大小)小于了参数文件中设置的MEMORY_TARGET值。
解决办法就是增大/dev/shm或是减小MEMORY_TARGET,下面是通过增加/dev/shm来解决:
修改前:
osedb01:~ # cat /etc/fstab | grep shm
shm /dev/shm tmpfs size=11g 0 0
osedb01:~ # df -h /dev/shm
Filesystem Size Used Avail Use% Mounted on
shm 11G 6.5G 4.5G 59% /dev/shm
MEMORY_TARGET 设置为10G,而/dev/shm可用空间的只有4.5G。
修改/dev/shm大小:
osedb01:~ # cat /etc/fstab | grep shm
shm /dev/shm tmpfs size=18g 0 0
修改完后,需要重新挂载/dev/shm生效:
osedb01:~ # mount -o remount /dev/shm
osedb01:~ # df -h /dev/shm
Filesystem Size Used Avail Use% Mounted on
shm 18G 6.5G 12G 36% /dev/shm
再次重启数据库,正常!!
附加:/dev/shm中的数据,在系统重启后,数据会被清空,注意!