再说ORA-00845: MEMORY_TARGET not supported on this system

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了再说ORA-00845: MEMORY_TARGET not supported on this system相关的知识,希望对你有一定的参考价值。

    

网上很多关于这个错误的文章,有些还引用了Oracle文档中的说明。

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_MAX_TARGET的大小。

但是根据测试的实际情况,必须是/dev/shm的可用空间不小于MEMORY_MAX_TARGET的大小。

例如

SQL> show parameter target

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
archive_lag_target                   integer     0
db_flashback_retention_target        integer     1440
fast_start_io_target                 integer     0
fast_start_mttr_target               integer     0
memory_max_target                    big integer 6336M
memory_target                        big integer 6336M
parallel_servers_target              integer     16
pga_aggregate_target                 big integer 0
sga_target                           big integer 0

 

根据参数,memory_max_target 参数为6.18G

[[email protected] ~]# mount -o remount,size=10G /dev/shm
[[email protected] ~]# df -h
Filesystem                        Size  Used Avail Use% Mounted on
/dev/mapper/vg_centosdbo-lv_root   50G   42G  5.3G  89% /
tmpfs                              10G  9.9G 144M  99% /dev/shm
/dev/sda2                         485M   39M  421M   9% /boot
/dev/sda1                         200M  260K  200M   1% /boot/efi
/dev/mapper/vg_centosdbo-lv_home  1.3T  504G  744G  41% /home
[[email protected] ~]# su – oracle

 

 

 

即便这里我设置size大小为10G。但是可用空间只有144M.

这时我启动数据库:

SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 30 14:29:21 2016

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system

仍然会报错。

如下所示,如果保证可用空间大于memory_max_target,则数据库正常启动。

[[email protected] ~]# mount -o remount,size=16G /dev/shm
[[email protected] ~]# df -h
Filesystem                        Size  Used Avail Use% Mounted on
/dev/mapper/vg_centosdbo-lv_root   50G   42G  5.3G  89% /
tmpfs                              16G  6.2G  9.9G  39% /dev/shm
/dev/sda2                         485M   39M  421M   9% /boot
/dev/sda1                         200M  260K  200M   1% /boot/efi
/dev/mapper/vg_centosdbo-lv_home  1.3T  504G  744G  41% /home
[[email protected] ~]# sqlplus /nolog
-bash: sqlplus: command not found
[[email protected] ~]# su - oracle
[[email protected] ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 30 14:30:41 2016

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.

Total System Global Area 6614106112 bytes
Fixed Size                  2213896 bytes
Variable Size            3556771832 bytes
Database Buffers         3019898880 bytes
Redo Buffers               35221504 bytes
Database mounted.
Database opened.
SQL>  

 

由此可能的情况是,/dev/shm默认为系统内存的一半,虽然理论上可能已经大于MEMORY_TARGET,但数据库启动是可能仍然会报错。

比如我所用的测试库,MEMORY_TARGET是6.18G

而默认/dev/shm为内存的一半,即7.7G左右。但数据库启动时仍然报错。

 

[[email protected] ~]# free -g
             total       used       free     shared    buffers     cached
Mem:            15         11          4          0          0         10
-/+ buffers/cache:          0         14
Swap:            7          0          7
[[email protected] ~]# 

 

以上是关于再说ORA-00845: MEMORY_TARGET not supported on this system的主要内容,如果未能解决你的问题,请参考以下文章

ORA-00845错误原因及解决办法

翻译自mos文章/dev/shm应该设置多大Oracle 实例启动时才能不报ORA-00845

ORA-00845 MEMORY_TARGET not supported on this system解决办法

ORA-00845: MEMORY_TARGET not supported on this system

ORA-00845 Raised When Starting Instance (文档 ID465048.1)

ORA-00845: MEMORY_TARGET not supported on this system