Oracle的AMM和ASMM以及相關引數探究
實驗出發點
引數存在的意義是什麼,要怎麼檢視資料庫啟動之後sga,pga等真正的大小。
2.如何啟用AMM和ASMM
3.存在靜態引數檔案中類似proc.__db_cache_size、proc.__pga_aggregate_target、*.__sga_target、proc.__shared_pool_size有什麼意義
環境說明:
1.作業系統版本。
-
[oracle@oracle ~]$ uname -a
-
Linux oracle.example.com 2.6.32-431.el6.x86_64 #1 SMP Sun Nov 10 22:19:54 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
-
[oracle@oracle ~]$ lsb_release -a
-
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
-
Distributor ID: RedHatEnterpriseServer
-
Description: Red Hat Enterprise Linux Server release 6.5 (Santiago)
-
Release: 6.5
- Codename: Santiago
-
SYS@proc> select * from v$version where rownum=1;
-
-
BANNER
-
--------------------------------------------------------------------------------
- Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
實驗過程:
一、實驗準備
1.通過靜態引數檔案將memory_max_target、memory_target、sga_max_size、sga_target、pga_aggregate_target、db_cache_size引數設定為0。
-
[oracle@oracle dbs]$ cat initproc.ora
-
*._in_memory_undo=TRUE
-
*.audit_file_dest='/u01/app/oracle/admin/proc/adump'
-
*.audit_trail='db'
-
*.compatible='11.2.0.4.0'
-
*.control_files='/u01/app/oracle/oradata/proc/control01.ctl','/u01/app/oracle/oradata/proc/control02.ctl'
-
*.db_block_size=8192
-
*.db_domain=''
-
*.db_file_multiblock_read_count=128
-
*.db_name='proc'
-
*.processes=150
-
*.remote_login_passwordfile='EXCLUSIVE'
-
*.undo_tablespace='UNDOTBS1'
-
memory_target=0
-
memory_max_target=0
-
sga_target=0
-
sga_max_size=0
- pga_aggregate_target=0
-
db_cache_size=0
-
SYS@proc> shutdown immediate;
-
Database closed.
-
Database dismounted.
-
ORACLE instance shut down.
-
SYS@proc> create spfile from pfile;
-
-
File created.
-
-
SYS@proc> startup;
-
ORACLE instance started.
-
-
Total System Global Area 175403008 bytes
Fixed Size 2251416 bytes
Variable Size 163579240 bytes
Database Buffers 4194304 bytes
Redo Buffers 5378048 bytes
Database mounted.
Database opened.
-
SYS@proc> show parameter memory%target
-
-
NAME TYPE VALUE
-
------------------------------------ ----------- ------------------------------
-
memory_max_target big integer 12M
-
memory_target big integer 0
-
SYS@proc> show parameter sga
-
-
NAME TYPE VALUE
-
------------------------------------ ----------- ------------------------------
- ...省略部分內容...
-
sga_max_size big integer 168M
-
sga_target big integer 0
-
SYS@proc> show parameter pga
-
-
NAME TYPE VALUE
-
------------------------------------ ----------- ------------------------------
- pga_aggregate_target big integer 0
-
SYS@proc> show parameter db_cache_size
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_cache_size big integer 4M
由於memory_target為0的情況下,sga_target為0,所以ASMM此刻是被禁用的
二、檢視資料庫開啟後各元件的真實大小以及依賴引數
1.動態檢視sga元件大小。
-
SYS@proc> select component,current_size from v$sga_dynamic_components;
-
-
COMPONENT CURRENT_SIZE
-
---------------------------------------------------------------- ------------
-
shared pool 159383552
-
large pool 0
-
java pool 4194304
-
streams pool 0
-
DEFAULT buffer cache 4194304
- ...省略部分內容...
-
-
14 rows selected.
-
-
SYS@proc> show sga
-
-
Total System Global Area 175403008 bytes
-
Fixed Size 2251416 bytes
-
Variable Size 163579240 bytes
-
Database Buffers 4194304 bytes
-
Redo Buffers 5378048 bytes
-
SYS@proc> select x.ksppinm name,y.ksppstvl value,x.ksppdesc describ
-
from sys.x$ksppi x,sys.x$ksppcv y
-
where x.inst_id=userenv('Instance')
-
and y.inst_id=userenv('Instance')
-
and x.indx=y.indx
-
and (x.ksppinm like '%sga%target%' or x.ksppinm like '%memory%target%' or x.ksppinm like '%pga%target%' or x.ksppinm like '%db_cache_size%');
-
-
NAME VALUE DESCRIB
-
---------------------------------------- ------------------------------ ------------------------------------------------------------------------------------------
-
sga_target 0 Target size of SGA
-
__sga_target 0 Actual size of SGA --該值在AMM或者ASMM下真實反映資料庫剛啟動時候分配的sga大小
-
memory_target 0 Target size of Oracle SGA and PGA memory
-
memory_max_target 12582912 Max size for Memory Target
-
__db_cache_size 4194304 Actual size of DEFAULT buffer pool for standard block size buffers
-
db_cache_size 4194304 Size of DEFAULT buffer pool for standard block size buffers
-
pga_aggregate_target 0 Target size for the aggregate PGA memory consumed by the instance
-
__pga_aggregate_target 0 Current target size for the aggregate PGA memory consumed
-
- 8 rows selected.
三、設定資料庫為AMM模式,對比各個元件變化情況
1.準備工作
1.1設定memory_max_target和memory_target等於1G。遇到了疑似BUG的報錯。
-
SYS@proc> alter system set memory_max_target=1g scope=spfile;
-
-
System altered.
-
-
SYS@proc> startup force;
-
ORACLE instance started.
-
-
Total System Global Area 175403008 bytes
-
Fixed Size 2251416 bytes
-
Variable Size 163579240 bytes
-
Database Buffers 4194304 bytes
-
Redo Buffers 5378048 bytes
-
Database mounted.
- Database opened.
-
-
SYS@proc> alter system set memory_target=1g;
-
alter system set memory_target=1g
-
*
-
ERROR at line 1:
-
ORA-03113: end-of-file on communication channel
-
Process ID: 4862
-
Session ID: 16 Serial number: 3
-
-
SYS@proc> select status from v$instance;
-
ERROR:
-
ORA-03114: not connected to ORACLE
-
-
-
SYS@proc> startup;
-
ORA-24324: service handle not initialized
- ORA-01041: internal error. hostdef extension doesn
-
Errors in file /u01/app/oracle/diag/rdbms/proc/proc/trace/proc_mman_5032.trc (incident=218646):
-
ORA-00600: internal error code, arguments: [kmgsb_resize_memory_target_2], [43], [42], [], [], [], [], [], [], [], [], []
-
Incident details in: /u01/app/oracle/diag/rdbms/proc/proc/incident/incdir_218646/proc_mman_5032_i218646.trc
-
Use ADRCI or Support Workbench to package the incident.
-
See Note 411.1 at My Oracle Support for error and packaging details.
-
Errors in file /u01/app/oracle/diag/rdbms/proc/proc/trace/proc_mman_5032.trc:
-
ORA-00600: internal error code, arguments: [kmgsb_resize_memory_target_2], [43], [42], [], [], [], [], [], [], [], [], []
-
MMAN (ospid: 5032): terminating the instance due to error 822
-
Sun Dec 11 08:00:40 2016
-
System state dump requested by (instance=1, osid=5032 (MMAN)), summary=[abnormal instance termination].
-
System State dumped to trace file /u01/app/oracle/diag/rdbms/proc/proc/trace/proc_diag_5026_20161211080040.trc
-
Dumping diagnostic data in directory=[cdmp_20161211080040], requested by (instance=1, osid=5032 (MMAN)), summary=[abnormal instance termination].
- Instance terminated by MMAN, pid = 5032
這裡做記錄即可。
1.3強制性在spfile中修改,然後重啟即可達到目的。
-
SYS@proc> startup;
-
ORACLE instance started.
-
-
Total System Global Area 175403008 bytes
-
Fixed Size 2251416 bytes
-
Variable Size 163579240 bytes
-
Database Buffers 4194304 bytes
-
Redo Buffers 5378048 bytes
-
Database mounted.
-
Database opened.
-
SYS@proc> alter system set memory_target=1g scope=spfile;
-
-
System altered.
-
-
SYS@proc> startup force;
-
ORACLE instance started.
-
-
Total System Global Area 638889984 bytes --對比下邊查出來的__sga_target可知從這裡看大小並不真實。有機會做個10046(驗證show sga的不準確)
-
Fixed Size 2255872 bytes
-
Variable Size 184550400 bytes
-
Database Buffers 448790528 bytes
-
Redo Buffers 3293184 bytes
-
Database mounted.
-
Database opened.
-
SYS@proc> show parameter memory%target
-
-
NAME TYPE VALUE
-
------------------------------------ ----------- ------------------------------
-
memory_max_target big integer 1G
-
memory_target big integer 1G
-
SYS@proc>
-
SYS@proc> col name for a40
-
SYS@proc> col value for a30
-
SYS@proc> col DESCRIB for a90
-
SYS@proc> select x.ksppinm name,y.ksppstvl value,x.ksppdesc describ
-
from sys.x$ksppi x,sys.x$ksppcv y
-
where x.inst_id=userenv('Instance')
-
and y.inst_id=userenv('Instance')
-
and x.indx=y.indx
-
and (x.ksppinm like '%sga%target%' or x.ksppinm like '%memory%target%' or x.ksppinm like '%pga%target%' or x.ksppinm like '%db_cache_size%');
-
-
NAME VALUE DESCRIB
-
---------------------------------------- ------------------------------ ------------------------------------------------------------------------------------------
-
sga_target 0 Target size of SGA
-
__sga_target 641728512 Actual size of SGA
-
memory_target 1073741824 Target size of Oracle SGA and PGA memory
-
memory_max_target 1073741824 Max size for Memory Target
-
__db_cache_size 448790528 Actual size of DEFAULT buffer pool for standard block size buffers
-
db_cache_size 0 Size of DEFAULT buffer pool for standard block size buffers
-
pga_aggregate_target 0 Target size for the aggregate PGA memory consumed by the instance
-
__pga_aggregate_target 432013312 Current target size for the aggregate PGA memory consumed
-
- 8 rows selected.
-
SYS@proc> alter system set sga_max_size=500m scope=spfile;
-
-
System altered.
-
-
SYS@proc> alter system set sga_target=500m;
-
-
System altered.
-
-
SYS@proc> alter system set pga_aggregate_target=525m; --1024-500=524,由於設定了sga_target=500m,可知pga_aggregate_target設定不能超過524
-
alter system set pga_aggregate_target=525m --反過來假設先設定pga_aggregate_target=500,在設定sga_target超過524是可以的,不過startup報ORA-00838:"Specified value of MEMORY_TARGET is too small, needs to be at least %sM"
-
*
-
ERROR at line 1:
-
ORA-02097: parameter cannot be modified because specified value is invalid
-
ORA-00840: PGA_AGGREGATE_TARGET cannot be modified to the specified value
-
-
-
SYS@proc> alter system set pga_aggregate_target=400m;
-
-
System altered.
-
-
SYS@proc> startup force;
- ...省略部分內容...
-
Database opened.
-
SYS@proc> show parameter pga
-
-
NAME TYPE VALUE
-
------------------------------------ ----------- ------------------------------
-
pga_aggregate_target big integer 400M
-
SYS@proc> show parameter sga
-
-
NAME TYPE VALUE
-
------------------------------------ ----------- ------------------------------
- ...省略部分內容...
-
sga_max_size big integer 500M
-
sga_target big integer 500M
-
SYS@proc> col name for a40
-
SYS@proc> col value for a30
-
SYS@proc> col DESCRIB for a90
-
SYS@proc> select x.ksppinm name,y.ksppstvl value,x.ksppdesc describ
-
from sys.x$ksppi x,sys.x$ksppcv y
-
where x.inst_id=userenv('Instance')
-
and y.inst_id=userenv('Instance')
-
and x.indx=y.indx
-
and (x.ksppinm like 'SYS@proc> SYS@proc> SYS@proc> 2 3 4 5 6 %sga%target%' or x.ksppinm like '%memory%target%' or x.ksppinm like '%pga%target%' or x.ksppinm like '%db_cache_size%');
-
-
NAME VALUE DESCRIB
-
---------------------------------------- ------------------------------ ------------------------------------------------------------------------------------------
-
sga_target 524288000 Target size of SGA
-
__sga_target 524288000 Actual size of SGA
-
memory_target 1073741824 Target size of Oracle SGA and PGA memory
-
memory_max_target 1073741824 Max size for Memory Target
-
__db_cache_size 331350016 Actual size of DEFAULT buffer pool for standard block size buffers
-
db_cache_size 0 Size of DEFAULT buffer pool for standard block size buffers
-
pga_aggregate_target 419430400 Target size for the aggregate PGA memory consumed by the instance
-
__pga_aggregate_target 549453824 Current target size for the aggregate PGA memory consumed
-
- 8 rows selected.
-
- SYS@proc> alter system set sga_target=400m;
-
- System altered.
- SYS@proc> alter system set pga_aggregate_target=400m;
- System altered.
-
-
SYS@proc> startup force;
- ...省略部分內容...
-
Database opened.
-
SYS@proc> show parameter sga
-
-
NAME TYPE VALUE
-
------------------------------------ ----------- ------------------------------
-
sga_max_size big integer 500M
-
sga_target big integer 400M
-
SYS@proc> show parameter pga
-
-
NAME TYPE VALUE
-
------------------------------------ ----------- ------------------------------
- pga_aggregate_target big integer 400M
-
-
SYS@proc>select x.ksppinm name,y.ksppstvl value,x.ksppdesc describ
-
from sys.x$ksppi x,sys.x$ksppcv y
-
where x.inst_id=userenv('Instance')
-
and y.inst_id=userenv('Instance')
-
and x.indx=y.indx
-
and (x.ksppinm like '%sga%target%' or x.ksppinm like '%memory%target%' or x.ksppinm like '%pga%target%' or x.ksppinm like '%db_cache_size%');
-
-
NAME VALUE DESCRIB
-
---------------------------------------- ------------------------------ ------------------------------------------------------------------------------------------
-
sga_target 419430400 Target size of SGA
-
__sga_target 524288000 Actual size of SGA
-
memory_target 1073741824 Target size of Oracle SGA and PGA memory
-
memory_max_target 1073741824 Max size for Memory Target
-
__db_cache_size 331350016 Actual size of DEFAULT buffer pool for standard block size buffers
-
db_cache_size 0 Size of DEFAULT buffer pool for standard block size buffers
-
pga_aggregate_target 419430400 Target size for the aggregate PGA memory consumed by the instance
-
__pga_aggregate_target 549453824 Current target size for the aggregate PGA memory consumed
-
- 8 rows selected.
若這是sga_target+pga_aggregate_target>memory_target是更改不成功的,若是強制性更改(即加上scope=spfile),則startup會報錯。
若sga_target+pga_aggregate_target<memory_target
若更改的sga_target<__sga_target,則實際sga的大小還是為原來更改之前__sga_target (__sga_target有點像高水位線)
若更改的sga_target>__sga_target,令__sga_target=sga_target,sga大小設定為__sga_target
而__pga_aggregate_target的實際的值則為memory_target-__sga_target,也就是__sga_target+__sga_target=memory_target。
3.sga_target和pga_aggregate_target同時設定大小(直接結論,實驗過程略去,下同)
結論是:sga_target設定大小,pga_aggregate_target沒有設定大小
那麼pga_aggregate_target初始化值=memory_target-sga_target
4.sga_target沒有設定大小,pga_aggregate_target設定大小
結論是:sga_target初始化值=memory_target-pga_aggregate_target
5.sga_target和pga_aggregate_target都沒有設定大小
結論是:Oracle將對這兩個值沒有最小值和預設值。Oracle將根據資料庫執行狀況進行分配大小。但在資料庫啟動是會有一個固定比例來分配:
sga_target = memory_target*60%
pga_aggregate_target = memory_target*40%
四、其它
1.如何降低“高水位線”“__sga_target”呢,經測試只能修改靜態引數檔案裡邊proc.__sga_target的值,而無法通過alter system set "__sga_target"=500m scope=spfile;的方式修改(會同時將sga_target和sga_max_size也手動設定調小),雖然可以成功執行。
2.實驗過程可得出AMM下,無論sga_target是否為0,ASMM是生效的。
有幾種情況:
2.1 memory_target<>0也就是AMM模式下,包含ASMM
2.2 memory_target=0也就是10G一樣的情況下
sga_target=0也就是禁用ASMM下,SGA中的各元件大小都要明確設定,不能自動調整各元件大小。
sga_target<>0(ASMM),系統自動調整SGA各元件大小。
PGA則依賴pga_aggregate_target的大小,因為10G模式下PGA不能自動調整。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30174570/viewspace-2139954/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle ASMM和AMMOracleASM
- 關於ASMM和AMMASM
- AMM與ASMMASM
- 【AMM】關於ASM中AMM引數說明ASM
- Oracle 11g AMM與ASMM切換OracleASM
- OracleASM關閉AMM,開啟ASMM,修改引數後報ORA-00843 ORA-00849OracleASM
- Oracle11g自動記憶體管理(AMM)相關的初始化引數Oracle記憶體
- Oracle Lob型別相關引數以及效能影響Oracle型別
- Linux 核心引數 和 Oracle相關引數調整LinuxOracle
- 【AMM】關於資料庫例項AMM引數說明資料庫
- ORACLE AMM 、ASMM 、自動記憶體管理(官方手冊)OracleASM記憶體
- oracle相關的linux核心引數OracleLinux
- statspack 安裝以及相關引數說明
- oracle 身份認證相關引數Oracle
- oracle sga配置相關的os 核心引數Oracle
- Linux 核心引數及Oracle相關引數調整LinuxOracle
- EBS相關日誌和引數
- 【Oracle】-【sqlplus相關】-serveroutput引數OracleSQLServer
- oracle 安裝相關引數設定Oracle
- 聊聊Oracle Optimizer相關的幾個引數(中)Oracle
- 聊聊Oracle Optimizer相關的幾個引數(下)Oracle
- Oracle查詢優化器的相關引數Oracle優化
- Oracle優化相關的一些引數Oracle優化
- (轉)Linux 核心引數及Oracle相關引數調整LinuxOracle
- Oracle安裝相關Linux引數(轉)OracleLinux
- 【轉】Oracle安裝相關Linux引數OracleLinux
- 有關ASM和ASMM的理解ASM
- Spark的相關引數配置Spark
- Oracle undo保留時間的幾個相關引數Oracle
- linux 跟oracle相關的系統核心引數?LinuxOracle
- Oracle direct path read相關隱含引數Oracle
- MySQL效能相關引數MySql
- 歸檔相關引數
- PostgreSQL AutoVacuum 相關引數SQL
- 與oracle緊密相關的unix/linux核心引數OracleLinux
- ORA-27102: out of memory以及相關係統引數
- MySQL的兩種filesort演算法介紹以及相關引數的設定和優化MySql演算法優化
- Linux核心引數(如kernel.shmmax)及Oracle相關引數調整LinuxHMMOracle