ORACLE常见报错之:ORA-00845: MEMORY_TARGET not supported on this system51CTO博客 - 众发娱乐

ORACLE常见报错之:ORA-00845: MEMORY_TARGET not supported on this system51CTO博客

2019-03-06 10:19:56 | 作者: 星爵 | 标签: 报错,体系,文件 | 浏览: 1241

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 Instances

Running 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的巨细。




版权声明
本文来源于网络,版权归原作者所有,其内容与观点不代表众发娱乐立场。转载文章仅为传播更有价值的信息,如采编人员采编有误或者版权原因,请与我们联系,我们核实后立即修改或删除。

猜您喜欢的文章