Oracle如何调整SGA和PGA的大小

Oracle 10G开始支持使用SGA_TARGET参数进行SGA自动,Oracle可自动调节共享池和数据缓冲池的大小,以下是OS:RH AS4 U7 64bit环境 Oracle 10.2.0.1版本的一个测试,先查看现在已有的SGA设置:

SQL> show parameter sga;
NAME                                 TYPE        VALUE
----------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 2G
sga_target                           big integer 2G

更改SGA大小:

SQL> alter system set sga_max_size=4096M scope=spfile;
System altered.
SQL> alter system set sga_target=4096M scope=spfile;
System altered.

如果是环境,需要这样增加sid='*':

alter system set sga_target=20G scope=spfile sid='*';

重启使更改生效:

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 4294967296 bytes
Fixed Size                  2026296 bytes
Variable Size             805307592 bytes
Database Buffers         3472883712 bytes
Redo Buffers               14749696 bytes
Database mounted.
Database opened.
SQL> show parameter sga;
NAME                                 TYPE        VALUE
----------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 4G
sga_target                           big integer 4G

如果更改spfile导致无法启动,可以在pfile后填加附加参数,现在一般的pfile都是一行SPFILE='spfileSID.ora',在后边加参数会覆盖spfile的已有参数:

SQL> alter system set lock_sga=true scope=spfile;
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORA-27102: out of memory
Linux-x86_64 Error: 12: Cannot allocate memory
[oracle@erpdevdb dbs]$ vi initerpstudydb.ora
SPFILE='+DGSTUDY/erpstudydb/spfileerpstudydb.ora'
lock_sga=false

SQL> startup
ORACLE instance started.

启动后,可以重新设置scope=spfile的参数,再删除pfile里后加的信息即可。

你可能感兴趣的:(转载,Oracle)