oracle 之 内存—鞭辟近里(四)
前面,我学习 pga内存的结构concept以及常用的动态查看pga的分配使用情况。现在我在学习一下怎么启动pga管理。
如果启动一个自动管理的pga,需要配置二个参数,一个是pga_aggregate_target,一个是workarea_size_policy,这些参数在前面我学习了,但是如何设置pga_aggregate_target这个参数在刚刚创建新的库的时候是可以通过前面oracle建议的步骤进行设定的,
但是运行一段时间后我们还是需要重新设置该参数:
1)pga advice view;
在查看该相关视图需要确保statistics_level运行在typical或是all状态,不然就没法查看建议值了。
Setting the
STATISTICS_LEVEL
parameter to
BASIC
disables the collection of many of the important statistics required by Oracle Database features and functionality, including:
-
Automatic Workload Repository (AWR) Snapshots
-
Automatic Database Diagnostic Monitor (ADDM)
-
All server-generated alerts
-
Automatic SGA Memory Management
-
Automatic optimizer statistics collection
-
Object level statistics
-
End to End Application Tracing (
V$CLIENT_STATS
) -
Database time distribution statistics (
V$SESS_TIME_MODEL
andV$SYS_TIME_MODEL
) -
Service level statistics
-
Buffer cache advisory
-
MTTR advisory
-
Shared pool sizing advisory
-
Segment level statistics
-
PGA Target advisory
-
Timed statistics
-
Monitoring of statistics
eg:
SYS@orcl#SHOW PARAMETER STATISTICS_LEVEL
------------------------------------ ---------------------- ------------------------------
statistics_level string TYPICAL
SYS@orcl#R
1* select PGA_TARGET_FOR_ESTIMATe/1024/1024 PGA_TARGET_FOR_ESTe,PGA_TARGET_FACTOR,ADVICE_STATUS,BYTES_PROCESSED/1024/1024 BYTES_PROCESSED,ESTD_TIME,ESTD_EXTRA_BYTES_RW/1024/1024 ESTD_EXTRA_BYTES_RW,ESTD_PGA_CACHE_HIT_PERCENTAGE,ESTD_OVERALLOC_COUNT from v$pga_target_advice
------------------- ----------------- ------ --------------- ---------- ------------------- ----------------------------- --------------------
32 .125 ON 1018.20703 22139 289.753906 78 41
64 .25 ON 1018.20703 22139 289.753906 78 41
128 .5 ON 1018.20703 17235 0 100 0
192 .75 ON 1018.20703 17235 0 100 0
256 1 ON 1018.20703 17235 0 100 0
307.199219 1.2 ON 1018.20703 17235 0 100 0
358.399414 1.4 ON 1018.20703 17235 0 100 0
409.599609 1.6 ON 1018.20703 17235 0 100 0
460.799805 1.8 ON 1018.20703 17235 0 100 0
512 2 ON 1018.20703 17235 0 100 0
768 3 ON 1018.20703 17235 0 100 0
------------------- ----------------- ------ --------------- ---------- ------------------- ----------------------------- --------------------
1024 4 ON 1018.20703 17235 0 100 0
1536 6 ON 1018.20703 17235 0 100 0
2048 8 ON 1018.20703 17235 0 100 0
可以看到我们应该设置pga_aggregate_target大小为128M。
如果我把statistics_level参数设置为basic,那么oracle就会取消相关的功能。
另外还有v$pga_target_advice_histogram;这个视图。