本文共 1179 字,大约阅读时间需要 3 分钟。
记录在share_pool中library cache中的对象信息
SQL> desc v$db_object_cache
Name Type
--------------- --------------------
OWNER VARCHAR2(64) --对象所有者
NAME VARCHAR2(1000) --对象名
DB_LINK VARCHAR2(64)
NAMESPACE VARCHAR2(28) --应该也是对象类型,没有确认
TYPE VARCHAR2(28) --对象类型(sequence,procedure,function,package,package body,trigger)
SHARABLE_MEM NUMBER --在共享池中占用的空间
LOADS NUMBER --被加载次数
EXECUTIONS NUMBER --执行次数
LOCKS NUMBER --当前所定对象的session数
PINS NUMBER --当前执行对象的session数
KEPT VARCHAR2(3) --对象是否常驻内存中,即是否使用dbms_shared_pool.keep固定
CHILD_LATCH NUMBER --子latch
通过查询v$db_object_cache可以确认出library cache中频繁加载的对象,或者占用内存比较多的对象
并根据实际情况进行优化
如果频繁加载的话可以使用dbms_share_pool包中的keep功能将对象keep到内存中
同时可以根据统计观察library_cache的使用
--查看是否用对象被keep到share_pool中
select type,kept,count(*) from v$db_object_cache group by type,kept order by count(*),kept;
--查看目前library_cache中所有对象总大小
select sum(SHARABLE_MEM)/1024/1024 m from v$db_object_cache;
--查看library_cache中占用空间比较大,并且没有被keep到内存中的对象
select owner,name,sharable_mem,kept from v$db_object_cache where sharable_mem>102400 and kept ='NO' order by sharable_mem;
--查看library_cache中频繁重新加载的对象
select owner,name,sharable_mem,kept,loads from v$db_object_cache order by loads;
转载地址:http://sjtci.baihongyu.com/