当前位置:Gxlcms > mysql > Oracle报错:ORA-00845:MEMORY_TARGETnotsupportedonthissyst

Oracle报错:ORA-00845:MEMORY_TARGETnotsupportedonthissyst

时间:2021-07-01 10:21:17 帮助过:30人阅读

Oracle常见报错之:ORA-00845: MEMORY_TARGET not supported on this system

Oracle常见报错之:ORA-00845: MEMORY_TARGET not supported on this system

1、 问题的提出

报错如下:
[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 ~]#

人气教程排行