本文 所涉及的项目,是在测试机上完成,其根据真实项目按照硬件能力进行了缩放。
有一航空分析系统,其用户量在20左右,其性质介于OLTP和 DatawareHouse之间,采用普通服务器,Linux平台,物理内存为4G,5块磁盘。
初步的内存的规划为
Oracle 系统占用: 4G*80% =3.2G
系统预留 : 4G*20%=800M
PGA占用 : 4G*80%*20%=640M
SGA占用 : 4G*80%-pga_aggregate_target=2.56G
Shared_Pool : 200M
Redo_buffer : 1M
Larger_pool :100M --为后期RMAN,数据迁移准备,提高其效率
JAVA_pool : 0M --由于系统用户采用CMD方式,进行数据操作故设置为0
DB_Buffer_cache: 2G
以下代码在以上数据 缩小了4倍
1. 设置 PGA
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 SQL> show parameter pga; 2 3 NAME TYPE VALUE 4 ------------------------------------ ----------- ------------------------------ 5 pga_aggregate_target big integer 91M 6 SQL> select issys_modifiable,name from v$parameter where name like 'pga_%'; 7 8 ISSYS_MOD NAME 9 --------- -------------------------------------------------------------------------------- 10 IMMEDIATE pga_aggregate_target 11 12 SQL> alter system set pga_aggregate_target=160M 13 2 ; 14 15 系统已更改。 16 17 SQL> show parameter pga; 18 19 NAME TYPE VALUE 20 ------------------------------------ ----------- ------------------------------ 21 pga_aggregate_target big integer 160M
2. 设置SGA
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 SQL> show parameter sga; 2 3 NAME TYPE VALUE 4 ------------------------------------ ----------- ------------------------------ 5 lock_sga boolean FALSE 6 pre_page_sga boolean FALSE 7 sga_max_size big integer 276M 8 sga_target big integer 276M 9 SQL> show sga; 10 11 Total System Global Area 289406976 bytes 12 Fixed Size 1248576 bytes 13 Variable Size 100664000 bytes 14 Database Buffers 180355072 bytes 15 Redo Buffers 7139328 bytes 16 SQL> select issys_modifiable,name from v$parameter where name like 'sga_%'; 17 18 ISSYS_MOD NAME 19 --------- -------------------------------------------------------------------------------- 20 FALSE sga_max_size 21 IMMEDIATE sga_target
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 SQL> alter system set sga_max_size=640M scope=spfile; 2 3 系统已更改。 4 5 SQL> shutdown immediate; 6 数据库已经关闭。 7 已经卸载数据库。 8 ORACLE 例程已经关闭。 9 SQL> startup 10 ORACLE 例程已经启动。 11 12 Total System Global Area 671088640 bytes 13 Fixed Size 1250812 bytes 14 Variable Size 482347524 bytes 15 Database Buffers 180355072 bytes 16 Redo Buffers 7135232 bytes 17 数据库装载完毕。 18 数据库已经打开。 19 SQL> show parameter sga; 20 21 NAME TYPE VALUE 22 ------------------------------------ ----------- ------------------------------ 23 lock_sga boolean FALSE 24 pre_page_sga boolean FALSE 25 sga_max_size big integer 640M 26 sga_target big integer 276M
3.设置 Shared_pool_size
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 SQL> show parameter shared_pool_size; 2 3 NAME TYPE VALUE 4 ------------------------------------ ----------- ------------------------------ 5 shared_pool_size big integer 0 6 SQL> select issys_modifiable,name from v$parameter where name like 'shared_%'; 7 8 ISSYS_MOD NAME 9 --------- -------------------------------------------------------------------------------- 10 FALSE shared_memory_address 11 IMMEDIATE shared_pool_size 12 FALSE shared_pool_reserved_size 13 IMMEDIATE shared_servers 14 IMMEDIATE shared_server_sessions
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 SQL> alter system set shared_pool_size=50M; 2 3 系统已更改。
4.设置Large_pool_size
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 SQL> show parameter large_pool_size; 2 3 NAME TYPE VALUE 4 ------------------------------------ ----------- ------------------------------ 5 large_pool_size big integer 0 6 SQL> alter system set large_pool_size=32M; 7 8 系统已更改。
5.设置DB_Cache_size
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 SQL> show parameter db_cache_size; 2 3 NAME TYPE VALUE 4 ------------------------------------ ----------- ------------------------------ 5 db_cache_size big integer 0 6 SQL> select issys_modifiable ,name from v$parameter where name like 'db_ca%'; 7 8 ISSYS_MOD NAME 9 --------- -------------------------------------------------------------------------------- 10 IMMEDIATE db_cache_size 11 IMMEDIATE db_cache_advice
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 SQL> alter system set sga_target=640M; 2 3 系统已更改。 4 5 SQL> alter system set db_cache_size =500M; 6 7 系统已更改。