时间:2021-07-01 10:21:17 帮助过:11人阅读
查看总的library cache pinhitratio 应该大于90%,最理想大于95%
SQL> select sum(pinhits)/sum(pins) pinhitratio from v$librarycache; PINHITRATIO ----------- .95701484
SQL> select sum(pins)/(sum(pins)+sum(reloads)) reloadhitratio from v$librarycache; RELOADHITRATIO -------------- .995477741
查看reloadhitratio 应该小于1%
SQL> select sum(reloads)/sum(pins) from v$librarycache; SUM(RELOADS)/SUM(PINS) ---------------------- .004542493
查看各个类型的library cache ratio, 看pinhitratio 这一行
SQL> select namespace,pins pinhits ,pinhitratio from v$librarycache; NAMESPACE PINHITS ---------------------------------------------------------------- ---------- PINHITRATIO ----------- SQL AREA 316416 .969154531 TABLE/PROCEDURE 81435 .94126604 BODY 48572 .998332373 NAMESPACE PINHITS ---------------------------------------------------------------- ---------- PINHITRATIO ----------- TRIGGER 228 .903508772 INDEX 2622 .768878719 CLUSTER 668 .986526946 NAMESPACE PINHITS ---------------------------------------------------------------- ---------- PINHITRATIO ----------- DIRECTORY 4 .5 QUEUE 6 .333333333 RULESET 3 .666666667 NAMESPACE PINHITS ---------------------------------------------------------------- ---------- PINHITRATIO ----------- TEMPORARY TABLE 808 0 TEMPORARY INDEX 302 0 EDITION 1560 .998717949 NAMESPACE PINHITS ---------------------------------------------------------------- ---------- PINHITRATIO ----------- DBLINK 0 1 OBJECT ID 0 1 SCHEMA 0 1 NAMESPACE PINHITS ---------------------------------------------------------------- ---------- PINHITRATIO ----------- DBINSTANCE 0 1 SQL AREA STATS 3347 .035853003 SQL AREA BUILD 0 1 18 rows selectedView Code
查看当前 library cache 的大小
SQL> select sum(sharable_mem) from v$db_object_cache; SUM(SHARABLE_MEM) ----------------- 137677939View Code
查看剩余的 shared pool
SQL> select * from v$sgastat where name=‘free memory‘ and pool=‘shared pool‘; POOL NAME BYTES ------------ -------------------------- ---------- shared pool free memory 216291184
数据库的 library cache hitratio 最好应该在95%以上,sum(reloads)与sum(pins) 的比值应该小于 1%,如果pinhitratio 小于90%,或者reload ratio 大于1% ,而且shared pool 的free memory 很小或者为0,那么可以适当增加shared_pool的大小,检查应用程序代码效率,比如是否使用了绑定变量等等.
oracle 基础知识(八)----Library Cache *
标签:就是 ora request requests 而且 esc rabl ace 效率