RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / 问题 / 946075
Accepted
Ethernets
Ethernets
Asked:2020-02-18 13:21:10 +0000 UTC2020-02-18 13:21:10 +0000 UTC 2020-02-18 13:21:10 +0000 UTC

Oracle DB 占用 RAM

  • 772

当您重新启动或打开服务器时,一切正常,内存正常,会话数也正常。但是连续工作2-3天后,消耗的内存明显增加,会话数增加到450+。据我所知,数据库会话应该自己抛出,这应该没有问题。

但是记忆会发生什么?目前是5.4GB,3天过去了。明天还会有更多。最后,它将依赖于数据库将停止接受新连接这一事实,即使所有内容都已卸载。只有重新启动有帮助。

帮助我理解。

在此处输入图像描述


添加

如果我们在 PGA\SGA 内存分配不正确上犯了罪,让我们看看实际上什么是管理不强:

SELECT name, sum(value/1024) "Value - KB"
   FROM v$statname n,
        v$session s,
        v$sesstat t
  WHERE s.sid=t.sid
    AND n.statistic# = t.statistic#
    AND s.type = 'USER'
    AND s.username is not NULL
    AND n.name in ('session pga memory', 'session pga memory max', 
        'session uga memory', 'session uga memory max')
  GROUP BY name

在输出中我们得到:

会话 uga 内存 24672.609375

会话 uga 内存最大 66495.8515625

会话 pga 内存 46984

会话 pga 内存最大 237577.875

让我们看看SGA:

SELECT (
   (SELECT SUM(value) FROM V$SGA) -
   (SELECT CURRENT_SIZE FROM V$SGA_DYNAMIC_FREE_MEMORY)
   ) "SGA_TARGET"
FROM DUAL;

结论:

SGA_TARGET:5465165824


PS OS Windows Server,2012 DB Oracle 11g-r2

oracle
  • 2 2 个回答
  • 10 Views

2 个回答

  • Voted
  1. Best Answer
    0xdb
    2022-09-26T22:48:24Z2022-09-26T22:48:24Z

    简要说明原因:分配给数据库的内存过多。

    更详细地说,在评论之后:

    之前他们没有太注意这个,直到1条内存条飞出来,等待新的供应,要保持服务器的性能

    数据库分配的内存已从一个合理的值(推荐的 40% 物理“黄金平均值”)增加到大约 80% 到 100%。

    需要减少数据库分配的内存大小(参考,见官方文档)。

    查看当前分配了多少:

    SQL> show parameters _target
    
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    memory_max_target                    big integer 1G
    memory_target                        big integer 1G
    pga_aggregate_target                 big integer 0
    sga_target                           big integer 0
    

    前两个参数设置为分配内存的当前值。其他两个值为 0 表示启用了自动内存管理(AMM 自动内存管理)。

    您可以首先看到分配内存的减少会带来什么:

    SQL> select * from v$memory_target_advice order by memory_size;
    
    MEMORY_SIZE MEMORY_SIZE_FACTOR ESTD_DB_TIME ESTD_DB_TIME_FACTOR    VERSION
    ----------- ------------------ ------------ ------------------- ----------
            256                ,25           17                   1          0
            512                 ,5           17                   1          0
            768                ,75           17                   1          0
           1024                  1           17                   1          0
           1280               1,25           17                   1          0
           1536                1,5           17                   1          0
           1792               1,75           17                   1          0
           2048                  2           17                   1          0
    

    该值MEMORY_SIZE_FACTOR=1是当前内存大小因子 (1024MB)。该列ESTD_DB_TIME_FACTOR将显示将分配的内存大小从 25% 更改为当前大小的 2 倍时数据库性能的预期变化(在工作数据库上会有其他值而不是 1)。

    假设我们需要减半(512MB,问题中最多约 3GB):

    SQL> alter system set memory_max_target=512M scope=spfile;
    
    System altered.
    
    SQL> alter system set memory_target=512M scope=spfile;
    
    System altered.
    
    SQL> shutdown immediate
    [...]
    SQL> startup
    ORACLE instance started.
    
    Total System Global Area  535662592 bytes
    Fixed Size                  1337720 bytes
    Variable Size             306185864 bytes
    Database Buffers          222298112 bytes
    Redo Buffers                5840896 bytes
    Database mounted.
    Database opened.
    SQL> show parameters _target
    
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    memory_max_target                    big integer 512M
    memory_target                        big integer 512M
    pga_aggregate_target                 big integer 0
    sga_target                           big integer 0
    
    • 5
  2. Артем Черепахин
    2020-02-18T16:33:16Z2020-02-18T16:33:16Z

    你的麻烦可能有很多原因。从应用程序本身开始,oracle缓存请求,到SGA、PGA、日志的错误大小分布。启动时需要多少 RAM?您正在使用什么内存管理?也许您的应用程序不是为如此大量的资源而设计的。从这里开始: https ://oracle-patches.com/oracle/tuning/3118-tuning-database-memory-oracle-buffers-caches-pga

    • 0

相关问题

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    根据浏览器窗口的大小调整背景图案的大小

    • 2 个回答
  • Marko Smith

    理解for循环的执行逻辑

    • 1 个回答
  • Marko Smith

    复制动态数组时出错(C++)

    • 1 个回答
  • Marko Smith

    Or and If,elif,else 构造[重复]

    • 1 个回答
  • Marko Smith

    如何构建支持 x64 的 APK

    • 1 个回答
  • Marko Smith

    如何使按钮的输入宽度?

    • 2 个回答
  • Marko Smith

    如何显示对象变量的名称?

    • 3 个回答
  • Marko Smith

    如何循环一个函数?

    • 1 个回答
  • Marko Smith

    LOWORD 宏有什么作用?

    • 2 个回答
  • Marko Smith

    从字符串的开头删除直到并包括一个字符

    • 2 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5