简单查看oracle的连接情况和内存使用情况
1、查看连接oracle的所有机器的连接数
select machine,count(*) from v$session group by machine;
2、查看连接oracle的所有机器的连接数和状态
select machine,status,count(*) from v$session group by machine,status order 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
UNION
select 'PGA' AS NAME,ROUND(value/1024/1024,2)||'M' AS "SIZE(M)" from v$pgastat where name='total PGA allocated'
UNION
select 'TOTAL' AS NAME,((SELECT ROUND(sum(value)/1024/1024,2) from v$sga)+(select ROUND(value/1024/1024,2) from v$pgastat where name='total PGA allocated'))||'M' AS "SIZE(M)" FROM DUAL
UNION
SELECT NAME,TO_CHAR(VALUE) FROM V$PGASTAT WHERE NAME='process count';
5、Oracle 11g设置内存自动管理:
ALTER SYSTEM SET MEMORY_TARGET = 1024M SCOPE=SPFILE;
ALTER SYSTEM SET memory_max_target = 1500M SCOPE=SPFILE;
ALTER SYSTEM SET SGA_TARGET = 0 SCOPE=SPFILE;
ALTER SYSTEM SET SGA_MAX_SIZE=800M SCOPE=SPFILE;
ALTER SYSTEM SET PGA_AGGREGATE_TARGET = 0 SCOPE=SPFILE;
alter system set pre_page_sga=FALSE scope=spfile;