oracle pga 查询

本文提供了一系列SQL查询示例,用于查询Oracle数据库中特定用户名(以'BM%'为模式匹配)的会话PGA内存使用情况,包括每个会话的PGA内存及最大PGA内存,并汇总了所有相关会话的总PGA内存使用。

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

SELECT  SS.SID,SS.USERNAME,SS.PROCESS,PP.NAME,PP.MM FROM (

(select * from v$session t where t.USERNAME like 'BM%')  SS  JOIN  

(select a.sid,b.name,(round(a.value/1024/1024,2))||'M' AS MM from v$sesstat a,v$statname b

where ( b.name like '%pga%') and a.statistic# = b.statistic#)  PP ON  SS.SID=PP.SID)

ORDER BY SS.USERNAME

 

=======================================================================

SELECT  SS.SID,SS.USERNAME,SS.PROCESS,PP.session_pga_memory,PP.session_pga_memory_max FROM (

(select * from v$session t where t.USERNAME like 'BM%')  SS  JOIN  

(

select spm.sid,spm.name,spm.session_pga_memory,spmx.session_pga_memory_max from 

(select a.sid,b.name,(round(a.value/1024/1024,2))||'M' AS session_pga_memory from v$sesstat a,v$statname b

where ( b.name like '%pga%') and a.statistic# = b.statistic# and b.name='session pga memory')  spm

join

(select a.sid,b.name,(round(a.value/1024/1024,2))||'M' AS session_pga_memory_max from v$sesstat a,v$statname b

where ( b.name like '%pga%') and a.statistic# = b.statistic# and b.name='session pga memory max')  spmx

on spm.sid = spmx.sid 

 

)  PP ON  SS.SID=PP.SID)

ORDER BY SS.USERNAME

 

=======================================================================

select username,sum(session_pga_memory)||'MB',sum(session_pga_memory_max)||'MB' from (

SELECT  SS.SID,SS.USERNAME,SS.PROCESS,PP.session_pga_memory,PP.session_pga_memory_max FROM (

(select * from v$session t where t.USERNAME like 'BM%')  SS  JOIN  

(

select spm.sid,spm.name,spm.session_pga_memory,spmx.session_pga_memory_max from 

(select a.sid,b.name,(round(a.value/1024/1024,2)) AS session_pga_memory from v$sesstat a,v$statname b

where ( b.name like '%pga%') and a.statistic# = b.statistic# and b.name='session pga memory')  spm

join

(select a.sid,b.name,(round(a.value/1024/1024,2)) AS session_pga_memory_max from v$sesstat a,v$statname b

where ( b.name like '%pga%') and a.statistic# = b.statistic# and b.name='session pga memory max')  spmx

on spm.sid = spmx.sid 

 

)  PP ON  SS.SID=PP.SID)

) group by username;


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值