1.查看每一个PGA能分配到的最大内存的命令
select ksppinm "name",ksppstvl/1024/1024||'M' "value",ksppdesc "desc"
from x$ksppi x,x$ksppcv y
where x.indx=y.indx and x.ksppinm='_pga_max_size';
2.查看每个进程中PGA的使用情况命令:
select spid,program,pga_max_mem,pga_alloc_mem,
pga_used_mem,pga_freeable_mem
from v$process
where program like '%OR%';
3. 查看PGA的大小设置为多大合适(通过命中率查看)
select pga_target_for_estimate/1024/1024||'M' "Estimate PGA Target",--假设PGA设置的大小
estd_pga_cache_hit_percentage "cache Hit(%)",--命中率
estd_extra_bytes_rw/1024/1024||'M' "extra read/write",--发生100M的物理磁盘读写
estd_overalloc_count "over alloc count"--出现20次IO读写
from v$pga_target_advice
4.查看当前会话发生的排序情况
select * from v$sysstat where name like '%sort%';
5.查看当前会话使用的PGA大小
select name,value
from v$statname a,v$mystat b
where a.statistic#=b.STATISTIC#
and a.name like '%pga%'