在Oracle 11g中如果采用AMM内存管理,那么当MEMORY_TARGET的值大于/dev/shm的时候,就会报ORA-00845: MEMORY_TARGET not supported on this system错误,解决办法增加/dev/shm大小,在redhat系列系统中,/dev/shm的默认值是系统总内存的一半
1、错误重现
SQL>SELECT * FROM V$VERSION;
BANNER
——————————————————————————–
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – Production
PL/SQL Release 11.2.0.3.0 – Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 – Production
NLSRTL Version 11.2.0.3.0 – Production
SQL>show parameter memory;
NAME TYPE VALUE
———————————— ———– ——————————
hi_shared_memory_address integer 0
memory_max_target big integer 500M
memory_target big integer 500M
shared_memory_address integer 0
SQL>alter system set memory_max_target=800m;
alter system set memory_max_target=800m
*
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified
SQL>alter system set memory_max_target=800m scope=spfile;
System altered.
SQL>alter system set memory_target=800m scope=spfile;
System altered.
SQL>shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@xifenfei admin]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Sat Nov 5 19:01:18 2011
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL>startup
ORA-00845: MEMORY_TARGET not supported on this system
SQL>!oerr ora 845
00845, 00000, "MEMORY_TARGET not supported on this system"
// *Cause: The MEMORY_TARGET parameter was not supported on this operating system or /dev/shm was not sized correctly on Linux.
// *Action: Refer to documentation for a list of supported operating systems. Or, size /dev/shm to be at least the SGA_MAX_SIZE on each Oracle instance running on the system.
2、修改/dev/shm大小
[root@xifenfei ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_xifenfei-lv_root
17G 13G 3.9G 77% /
tmpfs 590M 0 590M 0% /dev/shm
/dev/sda1 485M 30M 430M 7% /boot
[root@xifenfei ~]# mount -o size=900M -o nr_inodes=1000000 -o noatime,nodiratime -o remount /dev/shm
[root@xifenfei ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_xifenfei-lv_root
17G 13G 3.9G 77% /
tmpfs 900M 0 900M 0% /dev/shm
/dev/sda1 485M 30M 430M 7% /boot
[root@xifenfei ~]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Sat Nov 5 02:49:30 2011
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_xifenfei-lv_root / ext4 defaults 1 1
UUID=7ace6c04-d232-43ac-9ef5-70ea92fe49bd /boot ext4 defaults 1 2
/dev/mapper/vg_xifenfei-lv_swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults,size=900M 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
3、启动数据库验证
[oracle@xifenfei admin]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Sat Nov 5 19:03:51 2011
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
sys@XFF>show parameter memory;
NAME TYPE VALUE
———————————— ———– ——————————
hi_shared_memory_address integer 0
memory_max_target big integer 800M
memory_target big integer 800M
shared_memory_address integer 0
4、官方解释
Starting with Oracle Database 11g, the Automatic Memory Management feature requires more shared memory (/dev/shm)and file descriptors. The size of the shared memory should be at least the greater of MEMORY_MAX_TARGET and MEMORY_TARGET for each Oracle instance on the computer. If MEMORY_MAX_TARGET or MEMORY_TARGET is set to a non zero value, and an incorrect size is assigned to the shared memory, it will result in an ORA-00845 error at startup.
5、解决问题建议
5.1. If you are installing Oracle 11g on a Linux system, note that Memory Size (SGA and PGA), which sets the initialization parameter MEMORY_TARGET or MEMORY_MAX_TARGET, cannot be greater than the shared memory filesystem (/dev/shm) on your operating system. To resolve the current error, increase the /dev/shm file size.
5.2. If configuring AMM is not possible due to lack of space on /dev/shm mount point, you can configure ASMM instead of AMM, i.e. set SGA_TARGET, SGA_MAX_SIZE and PGA_AGGREGATE_TARGET instead of MEMORY_TARGET.