Oracle 11g新参数USE_LARGE_PAGES与AMM使用

简介: 在之前的文章(http://space.itpub.net/17203031/viewspace-774843)中,笔者介绍了如何在Linux 2.6内核中配置HugePage以及AMM与其的不兼容性。

在之前的文章(http://space.itpub.net/17203031/viewspace-774843)中,笔者介绍了如何在Linux 2.6内核中配置HugePage以及AMM与其的不兼容性。由于原理机制的差异,Oracle 11g引入的特性AMMAutomatic Memory Management)与HugePage是不可并存的。

 

在早期的11g版本中(11.2.0.2之前),AMMHugePage水火不容。如果操作系统启用了HugePage特性,同时数据库使用AMM的情况下,数据库实例启动是要报错的。Oracle推荐的做法是将AMM关闭,退化到ASMMAutomatic 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参数取值有三个,分别为TrueOnlyFalse。下面分别进行测试实验。

 

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_PAGESTRUE

 

 

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_PAGESTrue的时候,数据库启动运行没有问题,系统内存中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,应该是对AMMHugePage不兼容的弥合。借助这个参数,虽然不能让AMMHugePage彻底融合一体,但是至少可以消除由于不兼容引发的问题故障。

目录
相关文章
|
4月前
|
Oracle 关系型数据库 数据库
使用docker安装配置oracle 11g
使用docker安装配置oracle 11g
|
6月前
|
Oracle 关系型数据库 数据库
Oracle 11G常见性能诊断报告(AWR/ADDM/ASH)收集
Oracle 11G常见性能诊断报告(AWR/ADDM/ASH)收集
|
12天前
|
存储 SQL Oracle
【Oracle】玩转Oracle数据库(二):体系结构、存储结构与各类参数
【Oracle】玩转Oracle数据库(二):体系结构、存储结构与各类参数
35 7
|
1月前
|
存储 Oracle 关系型数据库
手把手教你安装Oracle——以oracle 11g为例
手把手教你安装Oracle——以oracle 11g为例
手把手教你安装Oracle——以oracle 11g为例
|
3月前
|
SQL Oracle 关系型数据库
oracle查询数据库参数sql语句
oracle查询数据库参数sql语句
|
4月前
|
SQL Oracle 关系型数据库
docker 方式安装ORACLE 11g
docker 方式安装ORACLE 11g
197 4
|
5月前
|
Oracle 关系型数据库 数据库
在Flink CDC中,使用Oracle 11g数据库的NUMBER类型作为主键
在Flink CDC中,使用Oracle 11g数据库的NUMBER类型作为主键
48 1
|
5月前
|
SQL Oracle 安全
window下Oracle 11G安装文档
window下Oracle 11G安装文档
|
7月前
|
Oracle 关系型数据库
Oracle 11g和12c的主要区别
Oracle 11g和12c的主要区别
|
9月前
|
Oracle 关系型数据库 数据库连接
Oracle 11g安装配置完美教程 - Windows(下)
Oracle 11g安装配置完美教程 - Windows(下)
154 0

推荐镜像

更多