暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

ORA-00845解决一例

云趣科技 2016-11-21
395

背景

维护窗口,客户DBA在启动Oracle实例时报错。


    sqlplus  as sysdba
    SQL*Plus: Release 11.2.0.4.0 Production on Thu Oct 20 21:07:45 2016
    Copyright (c) 1982, 2013, Oracle.  All rights reserved.
    Connected to an idle instance.
    SQL> startup
    ORA-00845: MEMORY_TARGET not supported on this system

一开始我们怀疑 Oracle 共享内存没释放,查看内存使用情况,并不存在泄露的共享内存。

    [root@db01:/root]#ipcs -m
    ------ Shared Memory Segments --------
    key        shmid      owner      perms      bytes      nattch     status
    0x74000388 5537792    root      600        4          0
    0x7400035e 6258689    root      600        4          0
    0x00000000 6619138    root      644        80         2
    0x7400035d 6225923    root      600        4          0
    0x00000000 6651908    root      644        16384      2
    0x00000000 6684677    root      644        280        2
    0x00000000 6750214    root      600        393216     2          dest
    0x00000000 6782983    root      600        393216     2          dest
    0x00000000 6815752    root      600        393216     2          dest
    0x00000000 6848521    root      600        393216     2          dest
    0x00000000 6881290    root      600        393216     2          dest
    0x00000000 6914059    root      600        393216     2          dest
    0x00000000 6946828    root      600        393216     2          dest
    0x00000000 6979597    root      600        393216     2          dest
    0x00000000 7012366    root      600        393216     2          dest
    0x00000000 7045135    root      600        393216     2          dest

查看系统内存,一个251G,SGA 大小 memory_target=170G,目前系统有162G 作为文件系统缓存的 page cache 没有释放,空闲物理内存只有85G,不足 170G,导致无法启动 Oracle 实例。

    [root@db01:/proc/sys/vm]#free -g
                 total       used       free     shared    buffers     cached
    Mem:           251        166         85          0          0        162
    -/+ buffers/cache:          3        248
    Swap:          137          0        137

尝试手动释放文件系统缓存,释放之后文件系统缓存依然占据120G内存,空闲内存为130G,依然不足以启动 Oracle 实例。

    echo 3 > proc/sys/vm/drop_caches
    [root@db01:/proc/sys/vm]#free -g
                 total       used       free     shared    buffers     cached
    Mem:           251        121        130          0          0        120
    -/+ buffers/cache:          1        250
    Swap:          137          0        137

解决方案:尝试重新挂在/dev/shm

关闭 ASM 实例。

    [grid@db01:/home/grid]$sqlplus  as sysasm
    SQL*Plus: Release 11.2.0.4.0 Production on Thu Oct 20 21:12:42 2016
    Copyright (c) 1982, 2013, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
    With the Real Application Clusters and Automatic Storage Management options
    SQL> shutdown abort;
    ASM instance shutdown

重新挂载/dev/shm。

    [root@db01:/proc/sys/vm]#mount -t tmpfs shmfs -o size=204800m /dev/shm
    [root@db01:/proc/sys/vm]#mount|grep shmfs
    shmfs on /dev/shm type tmpfs (rw,size=204800m)

文件系统的缓存也释放了。

    [oracle@db01:/home/oracle]$free -g
                 total       used       free     shared    buffers     cached
    Mem:           251          2        249          0          0          0
    -/+ buffers/cache:          1        250
    Swap:          137          0        137

启动 ASM 实例

    [grid@db01:/home/grid]$sqlplus / as sysasm
    SQL*Plus: Release 11.2.0.4.0 Production on Thu Oct 20 21:16:48 2016
    Copyright (c) 1982, 2013, Oracle.  All rights reserved.
    Connected to an idle instance.
    SQL> startup
    ASM instance started
    Total System Global Area 1135747072 bytes
    Fixed Size          2260728 bytes
    Variable Size        1108320520 bytes
    ASM Cache          25165824 bytes
    ASM diskgroups mounted
    ASM diskgroups volume enabled

启动 Oracle 实例

    [oracle@db01:/home/oracle]$sqlplus / as sysdba
    SQL*Plus: Release 11.2.0.4.0 Production on Thu Oct 20 21:17:31 2016
    Copyright (c) 1982, 2013, Oracle.  All rights reserved.
    Connected to an idle instance.
    SQL> startup
    ORACLE instance started.
    Total System Global Area 1.7103E+11 bytes
    Fixed Size          2262656 bytes
    Variable Size        1.0469E+11 bytes
    Database Buffers     6.6035E+10 bytes
    Redo Buffers          304508928 bytes
    Database mounted.
    Database opened.

解释

实例重启时出现 ORA-00845
错误的原因,猜想是因为
/dev/shm
文件系统中的内存在 Oracle 实例关闭是并没有释放,实例启动时无法申请到 170G 内存,导致 ORA-00845错误。



文章转载自云趣科技,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论