查看oracle的连接数和内存使用情况 值得收藏!
作为DBA需要对oracle的连接情况和内存使用情况了如指掌,不能等出问题的时候再去排除问题,平时也需要做好监控。下面分享下怎么通过sql去查看oracle的连接情况和内存使用情况。
1、查看连接oracle的所有机器的连接数
select machine,count(*) from v$session group by machine;
2、查看连接oracle的所有机器的连接数和状态
select machine,status,count(*)from v$sessiongroup by machine,statusorder by status;
3、oracle的PGA、SGA和process count
select 'SGA' AS NAME,ROUND(sum(value)/1024/1024,2)||'M' AS "SIZE(M)" from v$sga;
select 'PGA' AS NAME,ROUND(value/1024/1024,2)||'M' AS "SIZE(M)" from v$pgastatwhere name='total PGA allocated';
select 'TOTAL' AS NAME,((SELECT ROUND(sum(value)/1024/1024,2)from v$sga)+(select ROUND(value/1024/1024,2)from v$pgastatwhere name='total PGA allocated'))||'M' AS "SIZE(M)" FROM DUAL;
SELECT NAME,TO_CHAR(VALUE)FROM V$PGASTATWHERE NAME='process count';
4、查看oracle进程消耗的内存
SELECT * FROM V$PROCESS_MEMORY;
5、查看oracle进程的使用
SELECT PROGRAM, PGA_USED_MEM, PGA_ALLOC_MEM, PGA_FREEABLE_MEM, PGA_MAX_MEM FROM V$PROCESS;
大家有什么好的sql也可以一起分享下哦,共勉。
后面会开始分享下dblink、ogg、rac相关内容,大家有兴趣的话可以关注下哦~