oracle内存设置

 sga修改

1、备份启动文件
create pfile='/home/oracle/orcldb.ora' from spfile;
2、修改为30G
alter system set sga_max_size=200G scope=spfile;
alter system set sga_target=200G scope=spfile;
4、重启数据库
shutdown immediate;
startup;
5、如果启动失败:
startup pfile='/home/oracle/orcldb.ora';
还原:
create spfile from pfile;
重启:
shutdown immediate;
startup;
修改为10G:
alter system set sga_max_size=10G scope=spfile;
alter system set sga_target=10G scope=spfile;

手动管理内存改为自动管理内存

ALTER SYSTEM SET MEMORY_TARGET = 12G SCOPE=SPFILE;       #MEMORY_TARGET小于等于memory_max_target,二者均为0时为 手动管理内存
ALTER SYSTEM SET memory_max_target = 12G SCOPE=SPFILE;

ALTER SYSTEM SET SGA_TARGET = 0 SCOPE=SPFILE;              #SGA_TARGET和PGA_AGGREGATE_TARGET为0时  为自动管理内存
ALTER SYSTEM SET SGA_MAX_SIZE=10G SCOPE=SPFILE;

ALTER SYSTEM SET PGA_AGGREGATE_TARGET = 0 SCOPE=SPFILE;
ALTER SYSTEM SET PRE_PAGE_SGA=FALSE SCOPE=SPFILE;    #启动实例时,不加载全部SGA

自动管理内存改为手动管理内存

ALTER SYSTEM SET MEMORY_TARGET = 0 SCOPE=SPFILE;       #MEMORY_TARGET小于等于memory_max_target,二者均为0时为 手动管理内存
ALTER SYSTEM SET memory_max_target = 0 SCOPE=SPFILE;

ALTER SYSTEM SET SGA_TARGET = 1024M SCOPE=SPFILE;              #SGA_TARGET和PGA_AGGREGATE_TARGET为0时  为自动管理内存
ALTER SYSTEM SET SGA_MAX_SIZE=2048M SCOPE=SPFILE;

ALTER SYSTEM SET PGA_AGGREGATE_TARGET = 512M SCOPE=SPFILE;
alter system set pre_page_sga=TRUE scope=spfile;    #启动实例时,加载SGA全部物理内存。

你可能感兴趣的:(oracle,数据库,sql)