select machine,count(*) from v$session group by machine;
select machine,status,count(*) from v$session group by machine,status order by status;
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';
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;
Oracle 11g中引入了自动内存管理, 但oracle 11g依然支持手工内存分配:
1:oracle 11g使用memory_target来支持内存自动分配。
2:使用sga_target和pga_target参数来设置SGA和PGA,数据库会在这两个组件中自我优化。
3:你也可以手工设置SGA中的各个组件。比如db_cache_size,shared_pool_size等组件。
对自动内存管理的配置有两种情况,在创建数据库时或者是创建数据库后。
1:在数据库创建期间设置自动内存管理:如果是手工建库,那么你只需要设置好如下类似初始化参数即可:
2:在数据库创建后:你可以在数据库创建后添加memory_max_target和memory_target.虽然memory_target是一个动态参数,但是当数据库运行时,你不能交换到自动内存管理。必须重启数据库将参数应用到实例启动过程才行。
MEMORY_TARGET 设置为非零值时: