初次修改sga_target=0的影响

本次演示在rhel6.3+oracle11.2.0.4.160719版本上

 

在ASMM管理方式时,初次修改sga_target为0,变成手动管理后,sga_max_size参数也会随之变动。

 

1)初次修改sga_target

[oracle@shanxi dbca]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production onFri Aug 12 15:16:06 2016

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise EditionRelease 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Miningand Real Application Testing options

 

查看memory参数都是0,不是AMM管理方式
SQL> show parameter mem;

NAME                                 TYPE        VALUE
----------------------------------------------- ------------------------------
hi_shared_memory_address             integer     0
memory_max_target                    big integer 0
memory_target                        big integer 0
shared_memory_address                integer     0

 
查看pga
SQL> show parameter pga;

NAME                                 TYPE        VALUE
----------------------------------------------- ------------------------------
pga_aggregate_target                 big integer 300M

 
查看sga_target有值,是ASMM管理方式
SQL> show parameter sga;

NAME                                 TYPE        VALUE
----------------------------------------------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 1000M
sga_target                           big integer 1000M

附:sga的各项值

 初次修改sga_target=0的影响_第1张图片

 

 

设置sga_target=0
SQL> alter system set sga_target=0 scope=both;
System altered.


修改shared_pool_size和db_cache_size
SQL> alter system set shared_pool_size=200m scope=both;
System altered.

SQL> alter system set db_cache_size=500m scope=both;
System altered.

 
再次查看sga的值sga_target为0 ,sga_max_size不变依然为1000M
SQL> show parameter sga;

NAME                                 TYPE        VALUE
----------------------------------------------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 1000M
sga_target                           big integer 0

附:sga的各项值

初次修改sga_target=0的影响_第2张图片

 

 


2)重启数据库,查看sga_max_size值的变化


重启数据库
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

 
SQL> startup

ORACLE instance started.

Total System Global Area  747454464 bytes
Fixed Size                  2256912 bytes
Variable Size             218107888 bytes
Database Buffers          524288000 bytes
Redo Buffers                2801664 bytes
Database mounted.
Database opened.

 
再次查看sga的值sga_target为0 ,但sga_max_size的值变为713M,变小了,(变小的值为之前修改的shared_pool_size和db_cache_size的差值)
SQL> show parameter sga;

NAME                                 TYPE        VALUE
----------------------------------------------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 713M
sga_target                           big integer 0

附:sga的各项值

初次修改sga_target=0的影响_第3张图片

 

 


3)手工设置sga_max_size的值,观察是否变化


设置sga_max_size为之前的1000M
SQL> alter system set sga_max_size=1000m scope=spfile;
System altered.


再次重启数据库
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

 
SQL> startup

ORACLE instance started.

Total System Global Area 1043886080 bytes
Fixed Size                  2259840 bytes
Variable Size             511706240 bytes
Database Buffers          524288000 bytes
Redo Buffers                5632000 bytes
Database mounted.
Database opened.

 
查看sga_max_size变为1000M了
SQL> show parameter sga;

NAME                                 TYPE        VALUE
----------------------------------------------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 1000M
sga_target                           big integer 0

 
再重启一遍数据库
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.


SQL> startup

ORACLE instance started.

Total System Global Area 1043886080 bytes
Fixed Size                  2259840 bytes
Variable Size             511706240 bytes
Database Buffers          524288000 bytes
Redo Buffers                5632000 bytes
Database mounted.
Database opened.

 
发现sga_max_size依然没有变化,为1000M
SQL> show parameter sga;

NAME                                 TYPE        VALUE
----------------------------------------------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 1000M
sga_target                           big integer 0

附:sga的各项值

初次修改sga_target=0的影响_第4张图片

 

 


4)二次修改sga_target参数的值,观察sga_max_size值是否变化


修改sga_target=1000m 变成之前的ASMM管理方式
SQL> alter system set sga_target=1000m scope=spfile;
System altered.

 
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.


SQL> startup

ORACLE instance started.

Total System Global Area 1043886080 bytes
Fixed Size                  2259840 bytes
Variable Size             218104960 bytes
Database Buffers          817889280 bytes
Redo Buffers                5632000 bytes
Database mounted.
Database opened.

 
二次修改sga_target的值为0,变成手工管理方式
SQL> alter system set sga_target=0 scope=both;
System altered.

 
修改db_cache_size和shared_pool_size参数的值
SQL> alter system set db_cache_size=400m scope=both;
System altered.

SQL> alter system set shared_pool_size=150m scope=both;
System altered.

 
再重启数据库
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.


SQL> startup

ORACLE instance started.

Total System Global Area 1043886080 bytes
Fixed Size                  2259840 bytes
Variable Size             616563840 bytes
Database Buffers          419430400 bytes
Redo Buffers                5632000 bytes
Database mounted.
Database opened.

 
发现sga_max_size没变化,为1000M
SQL> show parameter sga;

NAME                                 TYPE        VALUE
----------------------------------------------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 1000M
sga_target                           big integer 0

附:sga的各项值

初次修改sga_target=0的影响_第5张图片

 

结论:在asmm管理方式时,初次修改sga_target=0为手工管理,sga_max_size的值会随着sga的值变化而变化(等于sag各个组件值的和),手工修改过一次sga_max_size的值,sga_max_size的值才会固定不变。

你可能感兴趣的:(Oracle,基本操作)