Welcome 微信登录

首页 / 数据库 / MySQL / Oracle报错:ORA-00845: MEMORY_TARGET not supported on this system

Oracle常见报错之:ORA-00845: MEMORY_TARGET not supported on this system1、 问题的提出报错如下:
[oracle@night ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Thu Jul 25 15:39:40 2013
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
SQL> conn sys/ as sysdba
Enter password:
Connected to an idle instance.
SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system
SQL>2、 问题的解释在官方文档中,有好多地方提到这个错误,可以通过官方文档进一步的了解这个报错的解释,以便于更快更准确更透彻的解决问题打开官方文档的error messages标签,可以看到有关错误代码的解释ORA-00845: 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.或者利用官方文档的搜索功能,搜索错误代码,也可以找到相应的解释和解决办法Setting Memory Target at Instance Startup on Linux
Starting with Oracle Database 11g Release 1 (11.1), Oracle provides the option of automatically managing SGA and PGA with a combined MEMORY_TARGETparameter without having to set SGA_TARGET and PGA_AGGREGATE_TARGET explicitly. This is supported on Linux, Windows, Solaris, HPUX, and AIX (reference Bug 7258378).
If you see the ORA-00845 error reported on Linux machines at Oracle instance startup when using the MEMORY_TARGET parameter, then check the size of /dev/shm. If /dev/shm is not configured, then mount it sized to be at least the value of MEMORY_TARGET. If /dev/shm is configured but the amount of available space reported (through df -k /dev/shm) is less than MEMORY_TARGET, then free the space or mount a larger /dev/shm to satisfy the MEMORY_TARGET size. Note that if you set theMEMORY_MAX_TARGET parameter greater than MEMORY_TARGET, then ensure that /dev/shm is sized to be at least the value of MEMORY_MAX_TARGET.
Memory Target for Oracle Database InstancesRunning Database Configuration Assistant (DBCA) defaults to this Automatic Memory Management option. In the case of upgrade or manual database creation,MEMORY_TARGET can be specified in the initialization parameter file.如上的内容就详细的解释了该错误是由于/dev/shm小于MEMORY_TARGET的大小,或者是/dev/shm根本就没有挂载,如果同时设置了MEMORY_TARGET和MENORY_MAX_TARGET,那么/dev/shm至少必须和MEMORY_MAX_TARGET的大小一致Insufficient Memory Target Errors
On Linux systems, if the operating system /dev/shm mount size is too small for the Oracle system global area (SGA) and program global area (PGA), then you encounter the following error:
ORA-00845: MEMORY_TARGET not supported on this system.
The cause of this error is an insufficient /dev/shm allocation. The total memory size of the SGA and PGA, which sets the initialization parameter MEMORY_TARGETor MEMORY_MAX_TARGET, cannot be greater than the shared memory file system (/dev/shm) on your operating system.
Background
Automatic Memory Management (AMM) has been updated in Oracle ASM 11g Release 2. It manages both the SGA and PGA together. It is managed by the Memory Manager Process (MMAN). In this release, note the following changes to AMM:
It uses MEMORY_TARGET instead of SGA_TARGET
It uses MEMORY_MAX_TARGET instead of SGA_MAX_SIZE (defaults to MEMORY_TARGET)
It uses memory allocated by /dev/shm
If the value of max_target is set to a value greater than the allocation for the /dev/shm size, then you may encounter the error ORA-00845: MEMORY_TARGET not supported on this system.
Note:
An ORA-00845 error can also occur if /dev/shm is not properly mounted. To rule out this possibility, run the command df -k to ensure that /dev/shm is mounted. For example:$ df -k
 
Filesystem 1K-blocks Used Available Use% Mounted on
shmfs 6291456 832356 5459100 14% /dev/shm
Solution
Increase the /dev/shm mountpoint size.
For example:
# mount -t tmpfs shmfs -o size=7g /dev/shm
To make this change persistent across system restarts, add an entry in /etc/fstab similar to the following:
shmfs /dev/shm tmpfs size=7g 0如上的内容不仅讲出了错误的原因,而且还大概的说了一下在oracle 11g中的自动内存管理,并且给出了该错误的解决的命令3、问题的深入探究,到底什么是 /dev/shm
首先来看一下linux系统中已经挂载的文件系统
[oracle@night ~]$ df -Th
文件系统      类型    容量  已用 可用 已用% 挂载点
/dev/sda2   ext3   16G 11G  3.9G  74% /
/dev/sda3   ext3    1.6G 37M  1.4G 3% /tmp
/dev/sda1   ext3   99M 12M 83M  13% /boot
tmpfs        tmpfs    252M   0  252M 0% /dev/shm可以看出我已经挂载了/dev/shm,但是该分区的文件系统并不是普通的文件系统类型,而是tmpfs文件系统类型,那么什么是tmpfs格式的文件系统类型呢?
tmpfs是linux的一种临时文件系统,它的大小是不固定的,默认的大小是实际内存的一半。
[root@night ~]# free -m
           total     used     free   shared    buffers   cached
Mem:         503        368        134          0       26        283
-/+ buffers/cache:       58        444
Swap:       2525          0     2525
[root@night ~]# df -Th /dev/shm/
文件系统      类型    容量  已用 可用 已用% 挂载点
tmpfs        tmpfs    252M   0  252M 0% /dev/shm
[root@night ~]#默认的挂载点是/dev/shm,/dev/shm其实就是一个目录,所以tmpfs也可以挂载到一个自定义的目录。
[root@night ~]# file /dev/shm/
/dev/shm/: sticky directory
[root@night ~]# ll -d /dev/shm/
drwxrwxrwt 2 root root 40 07-25 21:43 /dev/shm/
[root@night ~]#tmpfs可以使用系统内存,也可以使用swap,所以我可以把tmpfs的size适当的调高一点。
由于tmpfs是存在于内存中的,所以在卸载tmpfs或者是关机重启linux操作系统的时候,tmpfs的内容就会丢失。
tmpfs是基于内存的,而swap是基于磁盘的,所以两者是不同的,而且tmpfs的IO很高。4、解决问题
前面已经知道了报错是由于/dev/shm过小导致的,而且/dev/shm是一个tmpfs的文件系统,该文件系统是基于内存的,大小是随着物理内存的大小动态改变的,一般为物理内存的一半;tmpfs文件系统可以使用物理内容,也可以使用swap。
那么根据这么内容,来处理问题
首先看一下物理内存和swap的大小
[root@night ~]# free -m     
           total     used     free   shared    buffers   cached
Mem:         503        369        134          0       26        283
-/+ buffers/cache:       58        444
Swap:       2525          0     2525
[root@night ~]#由上可知道,RAM为500M左右,SWAP为2G修改tmpfs大小,用root用户
[root@night ~]# vim /etc/fstab内容如下
LABEL=/               /                     ext3    defaults        1 1
LABEL=/tmp              /tmp                    ext3    defaults        1 2
LABEL=/boot           /boot                 ext3    defaults        1 2
tmpfs                 /dev/shm                tmpfs defaults,size=1G        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                 /sys                    sysfs defaults        0 0
proc                    /proc                 proc    defaults        0 0
LABEL=SWAP-sda5       swap                    swap    defaults        0 0
~重新挂载/dev/shm
[root@night ~]# umount /dev/shm/
[root@night ~]# mount /dev/shm/
[root@night ~]# mount
/dev/sda2 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda3 on /tmp type ext3 (rw)
/dev/sda1 on /boot type ext3 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
none on /proc/fs/vmblock/mountPoint type vmblock (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
tmpfs on /dev/shm type tmpfs (rw,size=1G)
[root@night ~]# df -Th /dev/shm/
文件系统      类型    容量  已用 可用 已用% 挂载点
tmpfs        tmpfs    1.0G   0  1.0G 0% /dev/shm
[root@night ~]#现在重新启动oracle服务(切换oracle用户)
[oracle@night ~]$ df -Th /dev/shm/
文件系统      类型    容量  已用 可用 已用% 挂载点
tmpfs        tmpfs    1.0G   0  1.0G 0% /dev/shm
[oracle@night ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Thu Jul 25 22:05:01 2013
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
SQL> conn sys/ as sysdba
Enter password:
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area  418484224 bytes
Fixed Size                  1336932 bytes
Variable Size           281020828 bytes
Database Buffers          130023424 bytes
Redo Buffers                6103040 bytes
Database mounted.
Database opened.
SQL> !lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 25-JUL-2013 22:07:06
Copyright (c) 1991, 2009, Oracle.  All rights reserved.
Starting /u01/app/oracle/product/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/night/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=night)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                   LISTENER
Version                 TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                25-JUL-2013 22:07:15
Uptime                    0 days 0 hr. 0 min. 30 sec
Trace Level             off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File /u01/app/oracle/product/network/admin/listener.ora
Listener Log File       /u01/app/oracle/diag/tnslsnr/night/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=night)(PORT=1521)))
The listener supports no services
The command completed successfully
SQL> !ps -ef | grep thinkdba
oracle    4117   1  0 22:06 ?        00:00:00 ora_pmon_thinkdba
oracle    4119   1  0 22:06 ?        00:00:00 ora_vktm_thinkdba
oracle    4123   1  0 22:06 ?        00:00:00 ora_gen0_thinkdba
oracle    4125   1  0 22:06 ?        00:00:00 ora_diag_thinkdba
oracle    4127   1  0 22:06 ?        00:00:00 ora_dbrm_thinkdba
oracle    4129   1  0 22:06 ?        00:00:00 ora_psp0_thinkdba
oracle    4131   1  0 22:06 ?        00:00:00 ora_dia0_thinkdba
oracle    4133   1  1 22:06 ?        00:00:01 ora_mman_thinkdba
oracle    4135   1  0 22:06 ?        00:00:00 ora_dbw0_thinkdba
oracle    4137   1  0 22:06 ?        00:00:00 ora_lgwr_thinkdba
oracle    4139   1  0 22:06 ?        00:00:00 ora_ckpt_thinkdba
oracle    4141   1  0 22:06 ?        00:00:00 ora_smon_thinkdba
oracle    4143   1  0 22:06 ?        00:00:00 ora_reco_thinkdba
oracle    4145   1  1 22:06 ?        00:00:01 ora_mmon_thinkdba
oracle    4147   1  0 22:06 ?        00:00:00 ora_mmnl_thinkdba
oracle    4149   1  0 22:06 ?        00:00:00 ora_d000_thinkdba
oracle    4151   1  0 22:06 ?        00:00:00 ora_s000_thinkdba
oracle    4186  4066  2 22:06 ?        00:00:02 oraclethinkdba (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle    4192   1  0 22:06 ?        00:00:00 ora_qmnc_thinkdba
oracle    4208   1  1 22:06 ?        00:00:00 ora_cjq0_thinkdba
oracle    4210   1  0 22:06 ?        00:00:00 ora_q000_thinkdba
oracle    4212   1  0 22:06 ?        00:00:00 ora_q001_thinkdba
oracle    4214   1  0 22:06 ?        00:00:00 ora_vkrm_thinkdba
oracle    4222   1 29 22:07 ?        00:00:17 ora_j002_thinkdba
oracle    4231   1  5 22:07 ?        00:00:03 ora_j006_thinkdba
oracle    4237   1  4 22:07 ?        00:00:02 ora_j007_thinkdba
oracle    4250  4066  0 22:08 pts/1    00:00:00 /bin/bash -c ps -ef | grep thinkdba
oracle    4252  4250  0 22:08 pts/1    00:00:00 grep thinkdba
SQL>启动成功了查看memory_target的大小
SQL> show parameter memory
NAME                               TYPE        VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address           integer   0
memory_max_target                    big integer 400M
memory_target                        big integer 400M
shared_memory_address                integer   0
SQL>已经符合官方文档的说明了,/dev/shm大于memory_max_target的大小。相关阅读:关于ORA-01000: maximum open cursors exceeded" 问题分析总结 http://www.linuxidc.com/Linux/2013-06/86057.htm关于Oracle游标的问题(ORA-01000: maximum open cursors exceeded) http://www.linuxidc.com/Linux/2009-01/18148.htmOracle ORA-01000:maximum open cursors exceeded http://www.linuxidc.com/Linux/2013-01/77754.htmORA-01000: maximum open cursors exceeded http://www.linuxidc.com/Linux/2013-02/80071.htm更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12MySQL内存使用以及优化中需要的几点注意Oracle Database for Linux 不能使用退格键相关资讯      ORA-00845 
  • ORA-00845: MEMORY_TARGET not   (01月02日)
  • Oracle启动报错ORA-00845: MEMORY_  (11/27/2014 10:27:01)
  • Oracle 11g ORA-00845 在Linux 下  (04/22/2013 19:32:37)
  • Linux下/dev/shm的大小引发ORA-  (06/16/2015 20:23:36)
  • ORA-00845 Oacle 11g常见的shm问题  (07/26/2013 10:36:41)
  • CentOS 下修改/dev/shm 大小解决  (02/04/2013 21:30:15)
本文评论 查看全部评论 (0)
表情: 姓名: 字数