Oracle 11g新引數USE_LARGE_PAGES與AMM使用
在之前的文章(http://space.itpub.net/17203031/viewspace-774843)中,筆者介紹瞭如何在Linux 2.6核心中配置HugePage以及AMM與其的不相容性。由於原理機制的差異,Oracle 11g引入的特性AMM(Automatic Memory Management)與HugePage是不可並存的。
在早期的11g版本中(11.2.0.2之前),AMM與HugePage水火不容。如果作業系統啟用了HugePage特性,同時資料庫使用AMM的情況下,資料庫例項啟動是要報錯的。Oracle推薦的做法是將AMM關閉,退化到ASMM(Automatic Shared Memory Management)時代。
但是這樣的情況還是引起了Oracle官方的一定重視,因為必定是一個不相容性問題。在11.2.0.2的時候,Oracle新新增入一個引數USE_LARGE_PAGES來緩解問題。
USE_LARGE_PAGES最初是為了應對Bug 9195408而引入的,這個Bug的起因是當HugePage不足時候,Oracle一些的行為方式問題。在11.2.0.2版本上,如果資料庫伺服器上沒有空閒的HugePage使用,只有一些small pages使用的時候,會導致ORA-4030錯誤。
在11.2.0.3的時候,這個引數讓Oracle的行為更加靈活。如果出現HugePage分配不足的情況,SGA是可以使用那些small pages的。這就保證了極端情況下資料庫是可以正常執行的。
USE_LARGE_PAGES引數取值有三個,分別為True、Only和False。下面分別進行測試實驗。
1、基礎環境實驗
當前資料庫版本為11.2.0.3。
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 – Production
此時Oracle選擇ASMM,對應引數USE_LARGE_PAGES為TRUE。
SQL> show parameter use_large
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
use_large_pages string TRUE
SQL>
[root@SimpleLinux ~]# grep HugePage /proc/meminfo
HugePages_Total: 67
HugePages_Free: 1
HugePages_Rsvd: 0
SQL> show parameter target
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
archive_lag_target integer 0
db_flashback_retention_target integer 1440
fast_start_io_target integer 0
fast_start_mttr_target integer 0
memory_max_target big integer 0
memory_target big integer 0
parallel_servers_target integer 16
pga_aggregate_target big integer 100M
sga_target big integer 260M
此時:當我們使用ASMM,引數USE_LARGE_PAGES為True的時候,資料庫啟動執行沒有問題,系統記憶體中HugePage被使用。
2、引數取值True情況下,AMM實驗
我們保持USE_LARGE_PAGES引數不變的情況下,由ASMM切換到AMM。
SQL> alter system set memory_max_target=360M scope=spfile;
System altered.
SQL> alter system set memory_target=360M scope=spfile;
System altered.
SQL> alter system set sga_target=0 scope=spfile;
System altered.
SQL> alter system set sga_max_size=0 scope=spfile;
System altered.
SQL> alter system set pga_aggregate_target=0 scope=spfile;
System altered.
重新啟動,如果按照無此引數的行為,Oracle應該啟動報錯。
SQL> startup force
ORACLE instance started.
Total System Global Area 267833344 bytes
Fixed Size 1344312 bytes
Variable Size 176164040 bytes
Database Buffers 88080384 bytes
Redo Buffers 2244608 bytes
Database mounted.
Database opened.
啟動成功,我們檢視HugePage使用情況。
[root@SimpleLinux ~]# grep HugePage /proc/meminfo
HugePages_Total: 67
HugePages_Free: 67
HugePages_Rsvd: 0
[root@SimpleLinux ~]# ipcs -m
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 589824 oracle 640 4096 0
0x00000000 622593 oracle 640 4096 0
0x01606d30 655362 oracle 640 4096 0
HugePage功能啟動,空閒數等於總數,說明Oracle系統例項並沒有使用HugePage功能,而是採用Small Pages。從ipcs –m功能看,AMM也啟用。
SQL> show parameter target
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
archive_lag_target integer 0
db_flashback_retention_target integer 1440
fast_start_io_target integer 0
fast_start_mttr_target integer 0
memory_max_target big integer 360M
memory_target big integer 360M
parallel_servers_target integer 16
pga_aggregate_target big integer 0
sga_target big integer 0
這就說明引數USE_LARGE_PAGES的特性功能,當引數取值為True的時候,即使資料庫是AMM情況,系統啟動是沒有問題的。但是Linux HugePage功能啟用的情況下,Oracle沒有使用。
同樣,如果引數為True,那麼當系統的HugePage被使用盡,只有small pages的情況下,SGA也會繼續執行。此時,Oracle例項就執行在記憶體使用混合模式(Mixed Mode)下。
3、引數取值Only情況下
USE_LARGE_PAGES引數的第二個取值是Only,從含義上,表示Oracle例項只會使用HugePage作為記憶體使用。如果系統在AMM模式或者HugePage用盡的時候,資料庫就不能啟動或者報錯。
SQL> alter system set use_large_pages=only scope=spfile;
System altered.
SQL> startup force
ORA-27125: unable to create shared memory segment
[root@SimpleLinux ~]# grep HugePage /proc/meminfo
HugePages_Total: 67
HugePages_Free: 67
HugePages_Rsvd: 0
[root@SimpleLinux ~]# ipcs -m
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
資料庫例項建立過程中出現故障報錯,alter log中資訊如下:
Tue Oct 22 14:50:51 2013
ALTER SYSTEM SET use_large_pages='ONLY' SCOPE=SPFILE;
Tue Oct 22 14:51:14 2013
Shutting down instance (abort)
License high water mark = 3
USER (ospid: 27273): terminating the instance
Instance terminated by USER, pid = 27273
Tue Oct 22 14:51:15 2013
Instance shutdown complete
Tue Oct 22 14:51:15 2013
Starting ORACLE instance (normal)
Specified value of sga_max_size is too small, bumping to 268435456
******************************************************************
Large Pages are not compatible with specified SGA memory parameters
use_large_pages = "ONLY" cannot be used with memory_target,
memory_max_target, or use_indirect_data_buffers parameters
Large Pages are compatible with sga_target and shared_pool_size
******************************************************************
顯然從提示資訊中看到,在使用AMM的情況下,如果USE_LARGE_PAGES引數取值為only,就回到了原來不能啟動的情況。下面進行修復。
SQL> create pfile from spfile;
File created.
[oracle@SimpleLinux dbs]$ ls -l
total 9564
-rw-rw---- 1 oracle oinstall 1544 Sep 9 08:52 hc_ora11g.dat
-rw-r--r-- 1 oracle oinstall 2851 May 15 2009 init.ora
-rw-r--r-- 1 oracle oinstall 1137 Oct 22 14:56 initora11g.ora
-rw-r--r-- 1 oracle oinstall 1080 Oct 22 11:14 initora11g.ora.bk
-rw-r----- 1 oracle oinstall 24 Sep 9 08:52 lkORA11G
-rw-r----- 1 oracle oinstall 1536 Sep 9 09:02 orapwora11g
-rw-r----- 1 oracle oinstall 9748480 Oct 17 10:53 snapcf_ora11g.f
-rw-r----- 1 oracle oinstall 3584 Oct 22 14:50 spfileora11g.ora
*.undo_retention=300
*.undo_tablespace='UNDOTBS1'
*.use_large_pages='ONLY'
修改為:
*.undo_retention=300
*.undo_tablespace='UNDOTBS1'
*.use_large_pages='FALSE'
"initora11g.ora" 33L, 1138C written
重新啟動系統。
SQL> startup pfile=/u01/app/oracle/dbs/initora11g.ora
ORACLE instance started.
Total System Global Area 267833344 bytes
Fixed Size 1344312 bytes
Variable Size 176164040 bytes
Database Buffers 88080384 bytes
Redo Buffers 2244608 bytes
Database mounted.
Database opened.
--系統未使用HugePage特性
[oracle@SimpleLinux dbs]$ grep Huge /proc/meminfo
HugePages_Total: 67
HugePages_Free: 67
HugePages_Rsvd: 0
Hugepagesize: 4096 kB
當引數設定為Force的時候,Oracle例項會強制使用HugePage,如果此時還是AMM,就會報錯啟動故障。此外,如果在執行過程中,出現HugePage不足的情況,也會報錯。
4、引數取值False的情況
最後是False的情況。如果引數取值為False,就意味著無論何時,都不會使用HugePage特性。
AMM情況下我們就不進行實驗了,直接修改之前的pfile。
--修改引數檔案
*.pga_aggregate_target=104857600
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_max_size=272629760
*.sga_target=272629760
*.undo_retention=300
*.undo_tablespace='UNDOTBS1'
*.use_large_pages='FALSE'
"initora11g.ora" 31L, 1106C written
啟動資料庫,此時ASMM開啟。
SQL> startup pfile=/u01/app/oracle/dbs/initora11g.ora
ORACLE instance started.
Total System Global Area 272011264 bytes
Fixed Size 1344372 bytes
Variable Size 176163980 bytes
Database Buffers 88080384 bytes
Redo Buffers 6422528 bytes
Database mounted.
Database opened.
此時,雖然使用Linux共享記憶體,但是都是small pages,沒有使用HugePage特性。
[oracle@SimpleLinux dbs]$ ipcs -m
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 884736 oracle 640 8388608 28
0x00000000 917505 oracle 640 264241152 28
0x01606d30 950274 oracle 640 4194304 28
[oracle@SimpleLinux dbs]$ grep Huge /proc/meminfo
HugePages_Total: 67
HugePages_Free: 67
HugePages_Rsvd: 0
Hugepagesize: 4096 kB
引數設定為False之後,Oracle即使可以使用HugePage,也不會去使用。SGA分配完全使用small page來進行。
5、結論
Oracle引入的USE_LARGE_PAGES,應該是對AMM和HugePage不相容的彌合。藉助這個引數,雖然不能讓AMM和HugePage徹底融合一體,但是至少可以消除由於不相容引發的問題故障。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17203031/viewspace-775004/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Linux Hugepage ,AMM及 USE_LARGE_PAGES for oracle 11GLinuxOracle
- Oracle USE_LARGE_PAGES初始化引數Oracle
- Oracle 11g AMM與ASMM切換OracleASM
- 【AMM】關於ASM中AMM引數說明ASM
- Linux Hugepage ,AMM及 USE_LARGE_PAGES - 4Linux
- Linux Hugepage ,AMM及 USE_LARGE_PAGES - 3Linux
- Linux Hugepage ,AMM及 USE_LARGE_PAGES - 2Linux
- Linux Hugepage ,AMM及 USE_LARGE_PAGES - 1Linux
- Oracle的AMM和ASMM以及相關引數探究OracleASM
- 【AMM】關於資料庫例項AMM引數說明資料庫
- 【函式引數】Oracle 11g中使用“=>”顯式指明函式引數名與引數值的對應關係函式Oracle
- oracle 11g常用隱含引數Oracle
- 11g AMM和/dev/shmdev
- Oracle 11g RAC修改靜態引數Oracle
- AMM與ASMMASM
- Linux 11G RAC啟用HugePages與AMM的禁用Linux
- Oracle ASMM和AMMOracleASM
- Oracle 隱藏引數使用Oracle
- Oracle 12c新特性:IN-Memory Option - 快取與引數Oracle快取
- Oracle11g自動記憶體管理(AMM)相關的初始化引數Oracle記憶體
- oracle 11G引數檔案之伺服器引數檔案(spfile)與例項啟動的關係Oracle伺服器
- Oracle 11g 關於 AWR 的引數設定Oracle
- 雙下劃線開頭的記憶體引數對Oracle AMM行為的影響記憶體Oracle
- Oracle 靜態引數與動態引數型別介紹Oracle型別
- Oracle 11g DDL_LOCK_TIMEOUT引數說明Oracle
- Oracle 11g 鎖特性增加(引數ddl_lock_time)Oracle
- Oracle引數-隱藏引數Oracle
- Oracle 11g DRCP配置與使用(上)Oracle
- Oracle 11g DRCP配置與使用(下)Oracle
- oracle 引數Oracle
- Oracle ENABLE=broken引數與TCP KeepAliveOracleTCP
- Oracle 11.2中控制並行的新引數Oracle並行
- Oracle 11G 隱含引數“_controlfile_autobackup_delay”Oracle
- Oracle 11g 在solaris 10 上核心引數的設定Oracle
- Oracle 11g 新特性Oracle
- Oracle 12C新特性-資料泵新引數(LOGTIME)Oracle
- Oracle 12C新特性-資料泵新引數(VIEWS_AS_TABLES)OracleView
- Oracle 11g中的_optimizer_null_aware_antijoin隱含引數OracleNull