Configuring Kernel Parameters about SHMMAX on HP

【引言】

本文讲述了HP-UX服务器因系统参数shmmax参数设置不适当,导致修改Oracle 11g的SGA失败报错protection key fault的原因分析,及相对应的解决方案;因平时不常遇到HP-UX操作系统,且shmmax参数修改和LINUX系统完全不一样,故做此文以便回溯。

问题现象为:

HP-UX的一台服务器部署了Oracle 11g,SGA由原来的8GB调整为30GB后,使用如下命令进行调整后;因上述参数为Oracle静态参数,故还需要停启下Oracle的实例,重启实例时失败,报错protection key fault。

 

通过spfile方式修改 

1. 使用SYS用户以SYSDBA身份登录系统

2. 查看修改前sga_max_size,sga_target大小

show parameter sga_max_size;

show parameter sga_target;

3. 修改参数

alter system set sga_max_size=30G scope=spfile;

alter system set sga_target=30G scope=spfile;

但经查看/tmp/kmeminfo命令查看,内存时应该够,还剩53.1G(见下框标红处);

#/tmp/kmeminfo

tool: kmeminfo 10.49 - libp4 9.792 - libhpux 1.466 - HP CONFIDENTIAL

unix: HP-UX B.11.31 64bit Tukwila 9340 on host "TESTDB"

core: /dev/kmem live kernel!

link: Thu Jun 08 14:22:47 EAT 2017

boot: Thu Jun  8 15:35:31 2017

time: Fri Jul 10 13:43:12 2020

nbpg: 4096 bytes

----------------------------------------------------------------------

Physical memory usage summary (in page/byte/percent):

Physical memory         = 25121916   95.8g 100%  

Free memory             = 13908433   53.1g  55%  

这是为何?

经查看Oracle官方手册;

(https://docs.oracle.com/cd/E11882_01/server.112/e10839/appb_hpux.htm#UNXAR302)

有如下解释:

When an Oracle Database instance starts, it creates memory segments by dividing the shared memory allocated for creating the Oracle System Global Area (SGA) by the value of the HP-UX shmmax kernel parameter. For example, if 64 GB of shared memory is allocated for a single Oracle instance and the value of the shmmax parameter is 1 GB, then Oracle Database creates 64 shared memory segments for that instance.

Performance degradation can occur when an Oracle instance creates multiple shared memory segments. This is because each shared memory segment receives a unique protection key when Oracle Database creates the instance. The number of protection keys available depends on the system architecture as shown in the following table:

 

简译下:

当Oracle数据库实例启动时,通过将为创建Oracle系统全局区域(SGA)而分配的共享内存除以HP-UX shmmax内核参数的值来创建内存段。

举个栗子:

如果为一个Oracle实例分配了64 GB共享内存,而shmmax参数的值是1 GB(官方最小推荐值),那么Oracle数据库将为该实例创建64个共享内存段。

但又有如下限制情况:

当Oracle实例创建多个共享内存段时,可能会出现性能下降。这是因为在Oracle数据库创建实例时,每个共享内存段都会收到一个惟一的保护密钥。可用保护键的数量取决于系统架构,如PA-RISC处理器最多支持6个共享内存段的protection key;Itanium处理器最多支持14个共享内存段的protection key。

经查看HP-UX服务器的处理器为Itanium

TESTDB01:[/]#machinfoCPU info:               Intel(R) Itanium(R) Processor 9340 (1.6 GHz, 20 MB)

到了这里,大概能推断出原因为何了,推断如下:

本案中HP-UX安装oracle 11G时,使用的是Oracle官网推荐的shmmax参数值为1 GB(见如下图红框处,具体解释可查看本文最后附文的kernerl参数设置建议),鉴于上述描述Itanium处理器最多支持14个共享内存段的protection key,所以这里最多能够支持的SGA为14GB。

本案例出的描述SGA由原来的8G改为30G,当然报protection key fault错误。

那怎么办那? 继续看Oracle官网介绍

If the Oracle instance creates more shared memory segments than the number of protection keys, then the HP-UX operating system displays protection key faults.

Oracle recommends that you set the shmmax parameter value to the amount of available physical memory on the system. Doing this ensures that the entire shared memory for a single Oracle instance is assigned to one shared memory segment and the instance requires only one protection key.

翻译如下:

如果Oracle实例创建的共享内存段多于保护密钥的数量,则HP-UX操作系统将显示保护密钥错误。

Oracle建议将shmmax参数值设置为系统可用物理内存大小。可确保将一个Oracle实例的整个共享内存分配给一个共享内存段,并且该实例只需要一个保护密钥。

To display the list of active shared memory segments on the system, run the following command:

$ ipcs -m

使用命令 ipcs -m查看共享内存段

TESTDB:[/]# ipcs -mIPC status from /dev/kmem as of Fri Jul 10 14:52:24 2020T         ID     KEY        MODE        OWNER     GROUPShared Memory:m          0 0x411c01a9 --rw-rw-rw-      root      rootm          1 0x4e0c0002 --rw-rw-rw-      root      rootm          2 0x4120083a --rw-rw-rw-      root      rootm      32771 0x00a5c581 --rw-------     sfmdb     usersm          4 0x49189a4c --rw-r--r--      root      rootm          5 0xa90c0037 -----------      root      rootm     393223 0x00000000 --rw-------    oracle       dbam     163848 0x000167a1 --rw-r--r--    oracle       dbam     557066 0x003167a1 --rw-r--r--    oracle       dbam     327692 0xe4709d80 --rw-------    oracle       dbam     393230 0x00000000 --rw-------    oracle       dba

解决方案:

Ok,通过上述官方介绍,只要将shmmax改为物理内存大小即可。

步骤1:查看HP-UX服务器物理内存大小为95.8G

#/tmp/kmeminfo

tool: kmeminfo 10.49 - libp4 9.792 - libhpux 1.466 - HP CONFIDENTIAL

unix: HP-UX B.11.31 64bit Tukwila 9340 on host "TESTDB"

core: /dev/kmem live kernel!

link: Thu Jun 08 14:22:47 EAT 2017

boot: Thu Jun  8 15:35:31 2017

time: Fri Jul 10 13:43:12 2020

nbpg: 4096 bytes

----------------------------------------------------------------------

Physical memory usage summary (in page/byte/percent):

Physical memory         = 25121916   95.8g 100%  

Free memory             = 13908433   53.1g  55%  

步骤2:修改shmmax值(参考官网如下)

参考官网文档:Oracle  Database Installation Guide 11g Release 2 (11.2) for HP-UX Part Number E17880-01

For HP-UX Itanium:

Enter the following command to start the kcweb application:

# /usr/sbin/kcweb -F

Check the value or formula specified for each of these parameters and, if necessary, modify that value or formula.

If necessary, refer to the kcweb online Help for more information about completing this step.

根据 /usr/sbin/kcweb -F修改shmmax为102899367936=95.8G*2014^3如下,结果如下:

注意:

如果修改非动态参数的值,则必须重新启动系统。

因shmmax这里显示为Dynamic参数,故不需要重启服务器,THANK GOG 不用重启服务器。

至此,HP-UX修改shmmax参数成功,执行调整SGA为30G,重启实例时,不再进行protection key报错。

alter system set sga_max_size=30G scope=spfile;

alter system set sga_target=30G scope=spfile;

好了,这里插一个小插曲:

因大家平时都是面对的LUNIX系统,这里再介绍下LINUX如何更改shmmax参数。

参考官网

https://docs.oracle.com/cd/E11882_01/install.112/e47689/pre_install.htm#LADBI1188

下的2.14.1 Displaying and Changing Kernel Parameter Values

 

步骤如下(直接贴图不做介绍了):

附文(kernerl参数设置建议)

Configuring Kernel Parameters on HP-UX Systems

During installation, you can generate and run the Fixup script to check and set the kernel parameter values required for successful installation of the database. This script updates required kernel packages if necessary to minimum values.

If you cannot use the Fixup scripts, then verify that the kernel parameters shown in the following table are set to values greater than or equal to the minimum value shown. The procedure following the table describes how to verify and set the values manually.

Note:

The kernel parameter values in this section are minimum values only. For production database systems, Oracle recommends that you tune these values to optimize the performance of the system. Refer to your operating system documentation for more information about tuning kernel parameters.

Parameter

Minimum Value

ksi_alloc_max

32768

executable_stack

0

max_thread_proc

1024

maxdsiz

1073741824 (1 GB)

maxdsiz_64bit

2147483648 (2 GB)

maxssiz

134217728 (128 MB)

maxssiz_64bit

1073741824 (1 GB)

maxuprc

3686

msgmni

4096

msgtql

4096

ncsize

35840

maxfiles_lim

63488

maxfiles

1024

nflocks

4096

ninode

34816

nkthread

7184

nproc

4096

semmni

4096

semmns

8192

semmnu

4092

semvmx

​32767

shmmax

1073741824

shmmni

4096

shmseg

512

Note:

If the current value for any parameter is higher than the value listed in this table, then do not change the value of that parameter. The following kernel parameters are obsolete on HP-UX 11.31. You need not specify values for these parameters:

msgmap

ncallout

msgseg

To display the current value or formula specified for these kernel parameters, and to change them if necessary:

【参考】

Oracle  Database Installation Guide 11g Release 2 (11.2) for HP-UX Part Number E17880-01

【参考】

https://docs.oracle.com/cd/E11882_01/server.112/e10839/appb_hpux.htm#UNXAR010

【参考】

https://docs.oracle.com/cd/E11882_01/install.112/e47689/pre_install.htm#BABFDGHJ

关注个人微信公众号“一森咖记”

近期热文

你可能也会对以下话题感兴趣。点击链接便可查看。

猜你喜欢

转载自blog.csdn.net/db_murphy/article/details/107254311