USING Auotomatic Shared Memory Management(二)

2014-11-24 09:39:30 · 作者: · 浏览: 1
cope=spfile; System altered. SQL> alter system set pga_aggregate_target=78M scope=spfile; System altered. SQL> startup force ORACLE instance started. Total System Global Area 405020672 bytes Fixed Size 2213816 bytes Variable Size 251660360 bytes Database Buffers 146800640 bytes Redo Buffers 4345856 bytes Database mounted. Database opened. SQL> SQL> show parameter sga NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ lock_sga boolean FALSE pre_page_sga boolean FALSE sga_max_size big integer 388M sga_target big integer 312M SQL> show parameter memory NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ hi_shared_memory_address integer 0 memory_max_target big integer 0 memory_target big integer 0 shared_memory_address integer 0 SQL> show parameter pga_aggregate NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ pga_aggregate_target big integer 78M SQL> 好,开始做实验。首先,我不指定sga_max_size参数。 eg: SQL> alter system reset sga_max_size; System altered. SQL> If you do not specify SGA_MAX_SIZE, then Oracle Database selects a default value that is the sum of all components specified or defaulted at initialization SQL> alter system reset sga_max_size; System altered. SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 325685248 bytes Fixed Size 2213056 bytes Variable Size 167775040 bytes Database Buffers 150994944 bytes Redo Buffers 4702208 bytes Database mounted. Database opened. SQL> SQL> select sum(value) from v$sga; SUM(VALUE) ---------- 325685248 SQL> If you do specify SGA_MAX_SIZE, and at the time the database is initialized the value is less than the sum of the memory allocated for all components, either explicitly in the parameter file or by default, then the database ignores the setting for SGA_MAX_SIZE and chooses a correct value for this parameter. Note: The STATISTICS_LEVEL initialization parameter must be set to TYPICAL (the default) or ALL for automatic shared memory management to function.

一)启动asmm
启动asmm需要设置sga_target参数,然后statistics_leve 为typical 或是all,另外如下参数需要设置为0。还需要设置memory_target和memory_max_target参数。
large_pool_size,
java_pool_size
shared_pool_size
streams_pool_size
db_cache_size
然后手工设置如下需要参数
log_buffer
db_keep_cache_size
db_recycle_cache_size
db_nk_cache_size
二)监控asmm
我们可以使用v$sga_target_advice视图进行监视。
SQL> select * from v$sga_target_advice;
  SGA_SIZE SGA_SIZE_FACTOR ESTD_DB_TIME ESTD_DB_TIME_FACTOR ESTD_PHYSICAL_READS
---------- --------------- ------------ ------------------- -------------------
       156              .5           40              1.0256               10995
       234             .75           39                   1                9770
       312               1           39                   1                9770
       390            1.25           39                   1                9770
       468             1.5           39                   1                9770
       546            1.75           39                   1                9770
       624               2           39                   1                9770
7 rows selected.
SQL> 

可以看到oracle给予的建议值。另外该视图在awr中对应如下:
我们先抓取awr
eg:
[oracle@oracle-one ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Tue Aug 6 00:09:51 2013
Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, D