oracle 占用内存

1、在使用database configuration assistant 配置之时,注意设置SGA大小,一般会默认占用内存的40%,这样就特别慢了。

2、不使用oracle的时候把服务停掉。

3、使用oracle EM进行维护

4、https://www.cnblogs.com/sparkbj/p/6146363.html

操作 (oracle使用内存约等于 SGA+PGA,所以可以减少SGA与PGA解决你的问题,生产库慎用)
alter system set sga_max_size=100m scope=spfile; --减少SGA大小,静态参数,重启后生效
alter system set sga_target=80m scope=both; --动态参数;oracle推荐:启动时修改此参数,不要动态设置此参数
alter system set pga_aggregate_target=40m sope=both; ---减少pga大小
2、拓展
SGA_MAX_SIZE的大小不是随意指定的,必须满足一定条件的。
sga_max_size=100M,必须满足SGA所有组件的最小和;至少满足db_cache_size,log_buffer,shared_pool_size,large_pool_size,java_pool_size总和的大小)

这一点很重要,如果不满足oracle实例服务会经常挂!

oracle内存结构介绍:
Introduction to Oracle Memory Structures
Oracle uses memory to store information such as the following:

Program code
Information about a connected session, even if it is not currently active
Information needed during program execution (for example, the current state of a query from which rows are being fetched)
Information that is shared and communicated among Oracle processes (for example, locking information)
Cached data that is also permanently stored on peripheral memory (for example, data blocks and redo log entries)
The basic memory structures associated with Oracle include:
System Global Area (SGA), which is shared by all server and background processes.
Program Global Areas (PGA), which is private to each server and background process; there is one PGA for each process.
修改方法:

1.sqlplus “/ as sysdba"  2. 3.create pfile='d:/cj.ora' from spfile;  然后去你的oracle安装目录

  找一个init数据库名。ora这样一个文件

  把几个oracle内存参数改小点

  一个2G的内存是如下配置的:

  *.sga_max_size=712M

  *.large_pool_size=8M

  *.shared_pool_size=250M

  *.sort_area_size=0.5M

  *.db_cache_size=350M

  然后shutdown数据库

  1.shutdown immediate;  2. 3.create spfile from pfile='d:/cj2.ora';  4. 5.startup;  然后启动,就可以了。

  以上就是调整oracle内存参数,减少数据库内存占用的方法介绍。


5、知乎:

Oracle内存组件中,有一个叫做SGA的部分,这个部分如果设置了7G,启动之后,立马从内存中分割出7G,哪怕当前Oracle只用了100M。这7G也是不可以被其他任何机制回收和利用的。
而且Oracle是典型的耗内存应用,SGA组件里的BufferCache放的是真实的用户数据。可以避免分散的磁盘操作,而直接在SGA中完成对数据库的修改加工。
SGA是主要占内存的组件。其他PGA等等为用多少分配多少的基本原则。会发生回收机制的。
除此之外,你可以通过show parameter sga查看SGA的具体设置。


正式答下,oracle占用内存不会无限向上,而是预先划一片SGA和PGA,是固定的。如果是win系统默认安装,这个参数会是整机内存的40%。
然并卵,对于开发用或小应用,这些内存占用过多。一般SGA 2000M,PGA 300M足矣。
查设置参数
sqlplus/ as sysdba
Show parameter sga
Show parameter pga
设置
Alter system set sga_target=2000M SCOPE=spfile;
同理修改sga_max_size=2000m,pga_aggregate_target=300m
重启数据库实例

6、http://blog.csdn.net/linxidwx/article/details/52678250
SGA大小配置


猜你喜欢

转载自blog.csdn.net/huluanchushou/article/details/78952407