data dictionary cache 命中率

本文探讨了Oracle数据库中SharedPool设置对Datadictionary Cache的影响。通过实例展示当SharedPool设置过小时,Datadictionary Cache可能无法有效缓存数据字典信息,导致频繁磁盘I/O,进而降低查询效率。文章提供了检查Datadictionary Cache命中率和大小的方法,并建议当命中率低于95%时,适当增大SharedPool以提升性能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

如果 shared pool 设置过小,那么 data dictionary cache 也会相应的过小,没有足够的空间存储ORACLE的系统数据字典信息,从而导致ORACLE需要从硬盘读取数据字典信息,我们查看执行计划的时候看到的recursive calls就是代表的是从磁盘读取数据字典的次数。

SQL> select count(*) from dba_source;

COUNT(*)
----------
228222
Statistics
----------------------------------------------------------
312 recursive calls
0 db block gets
888 consistent gets
538 physical reads
0 redo size
413 bytes sent via SQL*Net to client
384 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
5 sorts (memory)
0 sorts (disk)
1 rows processed
SQL> select count(*) from dba_source;

COUNT(*)
----------
228222
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
818 consistent gets
0 physical reads
0 redo size
413 bytes sent via SQL*Net to client
384 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
可以看到第一次没有访问数据字典,所以recursive calls等于312,第二次,由于缓存了数据字典信息,所以recursive calls为0data

查看 data dictionary cache 的命中率
SQL> select sum(gets),sum(getmisses),(1-(sum(getmisses)/(sum(gets)+sum(getmisses)))) hitratio from v$rowcache;

SUM(GETS) SUM(GETMISSES) HITRATIO
---------- -------------- ----------
264014 15600 .944208802

查看data dictionary cache 的大小
SQL> select sum(sharable_mem) from v$sqlarea;

SUM(SHARABLE_MEM)
-----------------
14354029

如果data dictionary cache的命中率小于95%,应该适当增加shared pool 的大小

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值