Shared pool
shared pool可以分为库缓存(library cache)和数据字典缓存(dictionary cache)。Library cache存放了最近执行的SQL语句、存储过程、函数、解析树以及执行计划等。而dictionary cache则存放了在执行SQL语句过程中,所参照的数据字典的信息,包括SQL语句所涉及的表名、表的列、权限信息等。dictionary cache也叫做row cache,因为这里面的信息都是以数据行的形式存放的,而不是以数据块的形式存放的。
library cache包括shared sql areas,private sql areas(共享服务器模式下),pl/sql,package,control structure(比如locks,library cache handles)。
SQL AREA:也可以叫做CRSR,表示shared cursor,存放共享的SQL语句。
select pool,name,bytes from v$sgastat where name='free memory' and pool='shared pool';
v$db_object_cache来显示library cache中有哪些对象被缓存,以及这些对象的大小尺寸。
SELECT owner, name, sharable_mem, kept FROM V$DB_OBJECT_CACHE WHERE sharable_mem > 102400 AND kept = 'NO' ORDER BY sharable_mem DESC;
v$librarycache
查库缓冲区的使用情况
SELECT name,type,sharable_mem FROM V$DB_OBJECT_CACHE ORDER BY sharable_mem DESC;
select sum(sharable_mem) from v$db_object_cache;
查询shared pool的分配情况
select pool,name,bytes from v$sgastat where name='free memory' and pool='shared pool';
select * from v$sgastat where pool='shared pool' ;
查sga的current size
select component,current_size,oper_count,granule_size from v$sga_dynamic_components;
查sga的分配情况
select * from v$sgainfo;
查sga的free memory
select * from v$sga_dynamic_free_memory;