--查看内存相关参数
SYS@ test10g> col name for a30
SYS@ test10g> col value for a20
SYS@ test10g> select name, value
  from v$parameter
  where name in('sga_max_size',
    'db_cache_size',
    'shared_pool_reserved_size',
    'large_pool_size',
    'java_pool_size',
    'db_block_size',
    'db_block_buffers',
    'log_buffer',
    'sort_area_retained_size',
    'hash_area_size',
    'sessions',
    'open_cursors',
    'streams_pool_size',
    'sga_target',
    'pga_aggregate_target')
   order by name;

NAME                           VALUE
------------------------------ --------------------
db_block_buffers               0
db_block_size                  8192
db_cache_size                  0
hash_area_size                 131072
java_pool_size                 0
large_pool_size                0
log_buffer                     2879488
open_cursors                   300
pga_aggregate_target           68157440
sessions                       170
sga_max_size                   314572800
sga_target                     314572800
shared_pool_reserved_size      5872025
sort_area_retained_size        0
streams_pool_size              0


--查看PGA实际大小
SQL> select sum(value) from v$sesstat
     natural join v$statname
     where name='session pga memory';

SUM(VALUE)
----------
  45710324


--查看SGA实际大小
SQL> select sum(bytes) from v$sgastat;

SUM(BYTES)
----------
 314574992


--查看sga分配
SYS@ test10g> col COMPONENT for a30;
SYS@ test10g> select t.component, t.current_size/1024/1024 "current_size (MB)"
  from v$sga_dynamic_components t;
COMPONENT                      current_size (MB)
------------------------------ -----------------
shared pool                                  112
large pool                                     4
java pool                                     32
streams pool                                   0
DEFAULT buffer cache                         148
KEEP buffer cache                              0
RECYCLE buffer cache                           0
DEFAULT 2K buffer cache                        0
DEFAULT 4K buffer cache                        0
DEFAULT 8K buffer cache                        0
DEFAULT 16K buffer cache                       0
DEFAULT 32K buffer cache                       0
ASM Buffer Cache                               0

SQL> col value for 9999999999999999
SQL> select * from v$sga;

NAME                                       VALUE
------------------------------ -----------------
Fixed Size                               1220360
Variable Size                          150995192
Database Buffers                       369098752
Redo Buffers                             2973696


--shared pool建议(手动管理时)
select t.shared_pool_size_for_estimate "SP",
  t.estd_lc_size "EL",
  t.estd_lc_memory_objects "ELM",
  t.estd_lc_time_saved "ELT",
  t.estd_lc_time_saved_factor "ELTS%",
  t.estd_lc_memory_object_hits "ELMO"
from v$shared_pool_advice t;

        SP         EL        ELM        ELT      ELTS%       ELMO
---------- ---------- ---------- ---------- ---------- ----------
        52         12       1203       2176      .9918      48822
        64         23       2481       2194          1      49437
        76         30       3831       2194          1      49446
        88         30       3831       2194          1      49446
       100         30       3831       2194          1      49446
       112         30       3831       2194          1      49446
       124         30       3831       2194          1      49446
       136         30       3831       2194          1      49446
       148         30       3831       2194          1      49446
       160         30       3831       2194          1      49446
       172         30       3831       2194          1      49446
       184         30       3831       2194          1      49446
       196         30       3831       2194          1      49446
       208         30       3831       2194          1      49446
       220         30       3831       2194          1      49446
       232         30       3831       2194          1      49446


--buffer cache 建议(手动管理时)
select size_for_estimate "target M",
  buffers_for_estimate,
  estd_physical_read_factor "physical_read %",
  estd_physical_reads
  from v$db_cache_advice
  where name='DEFAULT'
  and block_size=(select value from v$parameter 
                  where name='db_block_size')
  and advice_status='ON';

target M BUFFERS_FOR_ESTIMATE physical_read % ESTD_PHYSICAL_READS
---------- -------------------- --------------- -------------------
        12                 1497          2.6352               20265
        24                 2994          1.8889               14526
        36                 4491          1.7167               13201
        48                 5988          1.0333                7946
        60                 7485               1                7690
        72                 8982               1                7690
        84                10479               1                7690
        96                11976               1                7690
       108                13473               1                7690
       120                14970               1                7690
       132                16467               1                7690
       144                17964               1                7690
       148                18463               1                7690
       156                19461               1                7690
       168                20958               1                7690
       180                22455               1                7690
       192                23952               1                7690
       204                25449               1                7690
       216                26946               1                7690
       228                28443               1                7690
       240                29940           .9981                7676


--PGA顾问
SQL> select pga_target_for_estimate,pga_target_factor,estd_extra_bytes_rw
     from v$pga_target_advice;

PGA_TARGET_FOR_ESTIMATE PGA_TARGET_FACTOR ESTD_EXTRA_BYTES_RW
----------------------- ----------------- -------------------
              17039360               .25                   0
               34078720                .5                   0
               51118080               .75                   0
               68157440                 1                   0
               81788928               1.2                   0
               95420416               1.4                   0
              109051904               1.6                   0
              122683392               1.8                   0
              136314880                 2                   0
              204472320                 3                   0
              272629760                 4                   0
              408944640                 6                   0
              545259520                 8                   0

已选择14行。


--SGA顾问
SQL> select sga_size,sga_size_factor,estd_db_time
     from v$sga_target_advice;

  SGA_SIZE SGA_SIZE_FACTOR ESTD_DB_TIME
---------- --------------- ------------
       300               1           72
       150              .5           72
       225             .75           72
       600               2           71
       450             1.5           71
       525            1.75           71
       375            1.25           71

已选择8行。


--AMM顾问 11g
select * from v$memory_target_advice order by memory_size;

MEMORY_SIZE MEMORY_SIZE_FACTOR ESTD_DB_TIME ESTD_DB_TIME_FACTOR    VERSION
----------- ------------------ ------------ ------------------- ----------
        300                 .5          705              1.0845          0
        450                .75          650                   1          0
        600                  1          650                   1          0
        750               1.25          650                   1          0
        900                1.5          650                   1          0
       1050               1.75          650                   1          0
       1200                  2          650                   1          0

posted on 2017-02-06 19:56  john2017  阅读(456)  评论(0编辑  收藏  举报