快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

数据库中如何查询pga/sga及组件值

这篇文章主要介绍数据库中如何查询pga/sga及组件值,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

创新互联公司作为成都网站建设公司,专注网站建设公司、网站设计,有关企业网站制作方案、改版、费用等问题,行业涉及玻璃钢坐凳等多个领域,已为上千家企业服务,得到了客户的尊重与认可。

查询buffer_cache设置的大小对于物理读次数和时间的预估影响:
select size_for_estimate         "Cache Size (MB)",
       size_factor,
       buffers_for_estimate      "Buffers",
       estd_physical_read_factor est_read_factor,
       estd_physical_reads       estd_phy_red,
       estd_physical_read_time   est_phy_red_t
  from v$db_cache_advice
 where name = 'DEFAULT'
   and block_size =
       (select value from v$parameter where name = 'db_block_size');

查询当sga组件大小
SQL> select component,current_size,max_size,min_size from v$sga_dynamic_components;

COMPONENT                                                        CURRENT_SIZE   MAX_SIZE   MIN_SIZE
---------------------------------------------------------------- ------------ ---------- ----------
shared pool                                                        4294967296          0 4294967296
large pool                                                          268435456          0  268435456
java pool                                                           134217728          0  134217728
streams pool                                                        436207616          0  436207616
DEFAULT buffer cache                                               1.6744E+10          0 1.6744E+10
KEEP buffer cache                                                           0          0          0
RECYCLE buffer cache                                                        0          0          0
DEFAULT 2K buffer cache                                                     0          0          0
DEFAULT 4K buffer cache                                                     0          0          0
DEFAULT 8K buffer cache                                                     0          0          0
DEFAULT 16K buffer cache                                                    0          0          0

COMPONENT                                                        CURRENT_SIZE   MAX_SIZE   MIN_SIZE
---------------------------------------------------------------- ------------ ---------- ----------
DEFAULT 32K buffer cache                                                    0          0          0
ASM Buffer Cache                                                            0          0          0

13 rows selected.

SQL>


SQL>  select pool,sum(bytes/1024/1024) size_m from v$sgastat group by pool;

POOL             SIZE_M
------------ ----------
             15983.9976
shared pool  4126.17428
streams pool  416.03157
large pool          256
java pool           128



oracle 提供了多个初始化参数,来设置SGA中各个部分的内存大小
SQL> show parameter shared_pool_size;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
shared_pool_size                     big integer 244M
控制共享池的大小,实例运行期间可以动态调整


SQL> show parameter java_pool_size;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
java_pool_size                       big integer 52M
 控制JAVA池的大小,实例运行期间可以动态调整


SQL> show parameter large_pool_size;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
large_pool_size                      big integer 60M
 控制大池的大小,实例运行期间可以动态调整


SQL> show  parameter streams_pool_size;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
streams_pool_size                    big integer 0
 控制流池的大小,实例运行期间可以动态调整


SQL> show parameter db_cache_size;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_cache_size                        big integer 160M
控制数据缓冲区的大小,实例运行期间可以动态调整


SQL> show parameter log_buffer;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_buffer                           integer     5603328
 控制日志缓冲区的大小,该参数在运行期间是不能修改的。


SQL> show parameter sga_target;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
sga_target                           big integer 0
与SGA的自动管理相关,如果值是零,需要DBA手动管理SGA


SQL> show parameter sga_max_size;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
sga_max_size                         big integer 524M
sga可以使用的最大内存,sga_target的值不能超过sga_max_size,在为SGA中个部分组成 分配内存时,SGA的总内存不能超过sga_max_size设置的值,否则会报错。sga_max_size 在实例运行期间不能够动态调整,必须先修改初始化参数文件,然后重启实例。
sga_max_size参数仅在实例运行期间有效,如果实例启动时发现SGA各部分组成的参数值 总和大于sga_max_size,实例会忽略当前设置的sga_max_size值,并修改sga_max_size为 当前SGA的最大值。

SQL> show parameter statistics_level;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
statistics_level                     string      TYPICAL
 该值与SGA内存的自动管理相关,值为typical或者all的时候oracle会根据会更加收集到的相关统计信息作为参照,确定如何分配SGA中的各部分内存。

 oracle SGA中的各部分内存都是以粒度进行分配与回收。粒度的大小不能由DBA设定,取决与SGA的大小,系统平台的类型。 在大多数平台下SGA<1G 粒度是4MB,SGA>1G 粒度是16MB。 在win32平台下,SGA>1G,粒度是8MB。设置oracle SGA中各部分的值时,需要是oracle 粒度的整倍数,否则oracle会自动进行调整
SQL> select component,granule_size from v$sga_dynamic_components;

COMPONENT                                                        GRANULE_SIZE
---------------------------------------------------------------- ------------
shared pool                                                           4194304
large pool                                                            4194304
java pool                                                             4194304
streams pool                                                          4194304
DEFAULT buffer cache                                                  4194304
KEEP buffer cache                                                     4194304
RECYCLE buffer cache                                                  4194304
DEFAULT 2K buffer cache                                               4194304
DEFAULT 4K buffer cache                                               4194304
DEFAULT 8K buffer cache                                               4194304
DEFAULT 16K buffer cache                                              4194304
DEFAULT 32K buffer cache                                              4194304
Shared IO Pool                                                        4194304
ASM Buffer Cache                                                      4194304
14 rows selected
oracle SGA中各部分组成粒度值

SQL> select name,bytes from v$sgainfo;
NAME                                  BYTES
-------------------------------- ----------
Fixed SGA Size                      1375820    存储数据库与实例的状态信息
Redo Buffers                        5795840
Buffer Cache Size                 167772160
Shared Pool Size                  255852544
data dictionary cache              62914560
Java Pool Size                     54525952
Streams Pool Size                         0
Shared IO Pool Size                       0
Granule Size                        4194304
Maximum SGA Size                  548237312
Startup overhead in Shared Pool    58720256
Free SGA Memory Available                 0
SGA中各部分内存分配情况查看

SQL> select * from v$sga;

NAME                      VALUE
-------------------- ----------
Fixed Size              1375820
Variable Size         373293492 包括共享池,大池,java池,流池几个组成部分。
Database Buffers      167772160  数据缓冲区(Buffer Cache Size)
Redo Buffers            5795840
SGA中各部分内存分配情况查看。

SGA中各个部分所使用的内存只能供自己使用,相互之间无法共享。如果Java Pool分配了1G的内存,但是当前数据库并没有运用流特性,分配给流池的空间也不能被SGA中的其他
组件使用。所以使用alter system set 设置SGA中各部分组成的内存的时候,需要谨慎设置以免导致系统内存的浪费,性能损耗。

SQL> show parameter shared_pool_size;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
shared_pool_size                     big integer 244M

SQL> alter system set shared_pool_size=230m;
System altered

SQL> show parameter shared_pool_size;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
shared_pool_size                     big integer 232M  

oracle自动根据粒度调整为粒度(此处是4MB)进行调整。


SQL> show parameter pga

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
pga_aggregate_target                 big integer 4G

SQL> select * from v$pgastat;

NAME                                                                  VALUE UNIT
---------------------------------------------------------------- ---------- ------------
aggregate PGA target parameter                                   4294967296 bytes
aggregate PGA auto target                                        2837357568 bytes
global memory bound                                               429496320 bytes
total PGA inuse                                                  1607690240 bytes
total PGA allocated                                              2188926976 bytes
maximum PGA allocated                                            1.0088E+10 bytes
total freeable PGA memory                                         176619520 bytes
process count                                                           336
max processes count                                                    1115
PGA memory freed back to OS                                      7.4384E+13 bytes
total PGA used for auto workareas                                 464832512 bytes

NAME                                                                  VALUE UNIT
---------------------------------------------------------------- ---------- ------------
maximum PGA used for auto workareas                              5814672384 bytes
total PGA used for manual workareas                                       0 bytes
maximum PGA used for manual workareas                               1062912 bytes
over allocation count                                                 82922
bytes processed                                                  3.2595E+14 bytes
extra bytes read/written                                         4.6775E+12 bytes
cache hit percentage                                                  98.58 percent
recompute count (total)                                            15634412

19 rows selected.

SQL>

以上是“数据库中如何查询pga/sga及组件值”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联行业资讯频道!


文章名称:数据库中如何查询pga/sga及组件值
本文来源:http://6mz.cn/article/psjoii.html

其他资讯