Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2833836
  • 博文数量: 200
  • 博客积分: 2413
  • 博客等级: 大尉
  • 技术积分: 3067
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-01 22:07
文章分类

全部博文(200)

文章存档

2018年(2)

2017年(8)

2016年(35)

2015年(14)

2014年(20)

2013年(24)

2012年(53)

2011年(44)

分类: Oracle

2014-07-07 16:36:25


1.什么是数据字典缓存 |what is data dictionary cache

什么是数据字典?
数据字典包含:
● 数据库中每个schema对象(tables, indexes, sequences, and database links)的定义
● schema对象分配空间总和及当前使用量
● oracle数据库的用户名、权限、角色赋予及审计信息

A memory area in the shared pool that holds data dictionary information. The data dictionary cache is also known as the row cache because it holds data as rows instead of buffers, which hold entire data blocks.
数据字典缓存是shared pool中保存数据字典信息的一个内存区域。数据字典缓存又称为row cache,因为它保存数据使用行而不是缓存(缓存保存整个数据块)。

2.Shared Pool: Dictionary Cache Statistics
数据库实例启动,数据字典缓存中不含任何数据。所有SQL语句都无法命中缓存。随着越来越多的数据读到数据字典缓存,缓存未命中率在降低。
最终,数据库达到均衡状态,使用最频繁的字典数据被缓存到数据字典缓存区域中。至此,缓存未命中极少发生。

3.V$ROWCACHE
--各数据字典访问量、未命中次数、命中率等信息
column parameter format a21
column pct_succ_gets format 999.9
column updates format 999,999,999
SELECT parameter
     , sum(gets)
     , sum(getmisses)
     , 100*sum(gets - getmisses) / sum(gets)  pct_succ_gets
     , sum(modifications)                     updates
  FROM V$ROWCACHE
 WHERE gets > 0
 GROUP BY parameter;
 
PARAMETER              SUM(GETS) SUM(GETMISSES) PCT_SUCC_GETS      UPDATES
--------------------- ---------- -------------- ------------- ------------
dc_database_links             81              1          98.8            0
dc_free_extents            44876          20301          54.8       40,453
dc_global_oids                42              9          78.6            0
dc_histogram_defs           9419            651          93.1            0
dc_object_ids              29854            239          99.2           52
dc_objects                 33600            590          98.2           53
dc_profiles                19001              1         100.0            0
dc_rollback_segments       47244             16         100.0           19
dc_segments               100467          19042          81.0       40,272
dc_sequence_grants           119             16          86.6            0
dc_sequences               26973             16          99.9       26,811
dc_synonyms                 6617            168          97.5            0
dc_tablespace_quotas         120              7          94.2           51
dc_tablespaces            581248             10         100.0            0
dc_used_extents            51418          20249          60.6       42,811
dc_user_grants             76082             18         100.0            0
dc_usernames              216860             12         100.0            0
dc_users                  376895             22         100.0            0

**注:PARAMETER列,dc_表示数据字典,dc_后面为数据字典名称。
如,dc_sequences表示序列。

例子中,dc_free_extents、dc_used_extents、dc_segments存在大量未命中、更新,这说明数据库实例存在显著的动态空间扩张。

--数据字典缓存区域整体命中率
SELECT (SUM(GETS - GETMISSES - FIXED)) / SUM(GETS) "ROW CACHE HIT RATIO" FROM V$ROWCACHE;


------------------------------------------------------------------------
1.什么是数据字典缓存 |what is library cache
library cache是shared pool中的一部分。其包含了SQL areas, private SQL areas及PL/SQL存储过程及包等。

2.V$LIBRARYCACHE 
V$LIBRARYCACHE记录了实例启动以来,library cache中各个namespace的统计信息。

--每个namespace详细信息
SELECT NAMESPACE, PINS, PINHITS, RELOADS, INVALIDATIONS
  FROM V$LIBRARYCACHE
 ORDER BY NAMESPACE;
 
NAMESPACE             PINS    PINHITS    RELOADS INVALIDATIONS
--------------- ---------- ---------- ---------- -------------
BODY                  8870       8819          0             0
CLUSTER                393        380          0             0
INDEX                   29          0          0             0
OBJECT                   0          0          0             0
PIPE                 55265      55263          0             0
SQL AREA          21536413   21520516      11204             2 <----------
TABLE/PROCEDURE   10775684   10774401          0             0
TRIGGER               1852       1844          0             0


**注:
SQL AREA:21536413表示执行了21536413次。
 11204表示library cache 11204次未命中,需要oracle数据库隐含的重新分析语句或者阻止或者重新加载对象定义,
 因为涉及到的对应已将过久被清理出了library cache(这就是RELOAD)。
 2表示该SQL语句invalidated两次,再次导致了library cache未命中。(INVALIDATIONS:因为依赖对象被修改,造成某namespace中的对象被标记为无效)

--Library Cache Hit Ratio
select sum(pinhits) / sum(pins)*100 "Library Cache Hit Ratio" from V$LIBRARYCACHE;

Library Cache Hit Ratio
-----------------------
             98.2777228
 
**注:
98.2777228表示library命中率是98%,约2%的执行结果正在重新分析中。

其他:
--SGA中free sapce
SELECT * FROM V$SGASTAT 
 WHERE NAME = 'free memory'
   AND POOL = 'shared pool';
   
POOL         NAME                            BYTES
------------ -------------------------- ----------
shared pool  free memory                 236520152   
 
 

阅读(3696) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~