linux 上的 shmmax 参数

    技术2022-05-11  84

    shmmax内核参数定义单个共享内存段的最大值,如果该参数设置小于Oracle SGA设置,那么SGA就会被分配多个共享内存段。这在繁忙的系统中可能成为性能负担,带来系统问题。

    Linux上该参数的缺省值通常为32M。

    查看当前shmmax [root@localhost ~]# more /proc/sys/kernel/shmmax1073741824

    通过ipcs命令查看共享内存的分配,如果是默认的32M,可以看到Oracle分配了多个共享内存段以满足SGA设置的需要

    [root@localhost ~]# ipcs  -sa

    ------ Shared Memory Segments --------key        shmid      owner      perms      bytes      nattch     status0xb865fd98 360449     oracle9   640        171966464  180x00000000 262146     oracle9   600        393216     2          dest

    ------ Semaphore Arrays --------key        semid      owner      perms      nsems0x6428328c 229376     oracle9   640        154

    ------ Message Queues --------key        msqid      owner      perms      used-bytes   messages

    使用pmap我们可以看到每个共享内存段的地址空间

    [root@localhost ~]# ps -ef |grep test9ioracle9   3421     1  0 Jan05 ?        00:00:06 ora_pmon_test9ioracle9   3423     1  0 Jan05 ?        00:00:03 ora_psp0_test9ioracle9   3425     1  0 Jan05 ?        00:00:00 ora_mman_test9ioracle9   3427     1  0 Jan05 ?        00:00:05 ora_dbw0_test9ioracle9   3429     1  0 Jan05 ?        00:00:05 ora_lgwr_test9ioracle9   3431     1  0 Jan05 ?        00:00:27 ora_ckpt_test9ioracle9   3433     1  0 Jan05 ?        00:00:28 ora_smon_test9ioracle9   3435     1  0 Jan05 ?        00:00:00 ora_reco_test9ioracle9   3437     1  0 Jan05 ?        00:00:41 ora_cjq0_test9ioracle9   3439     1  0 Jan05 ?        00:00:17 ora_mmon_test9ioracle9   3441     1  0 Jan05 ?        00:00:11 ora_mmnl_test9ioracle9   3443     1  0 Jan05 ?        00:00:00 ora_d000_test9ioracle9   3445     1  0 Jan05 ?        00:00:00 ora_s000_test9ioracle9   3449     1  0 Jan05 ?        00:00:00 ora_qmnc_test9ioracle9   3461     1  0 Jan05 ?        00:00:00 ora_q000_test9ioracle9   3463     1  0 Jan05 ?        00:00:00 ora_q001_test9ioracle9   3872     1  0 Jan05 ?        00:00:06 oracletest9i (LOCAL=NO)oracle9   7286     1  0 11:23 ?        00:00:00 ora_j000_test9iroot      7289  7214  0 11:23 pts/1    00:00:00 grep test9i[root@localhost ~]# pmap 34273427:   ora_dbw0_test9i0017c000     72K r-x--  /libnsl-2.3.4.so0018e000      8K rw---  /libnsl-2.3.4.so00190000      8K rw---    [ anon ]0099e000     84K r-x--  /ld-2.3.4.so009b3000      4K r----  /ld-2.3.4.so009b4000      4K rw---  /ld-2.3.4.so00b07000      8K r-x--  /libdl-2.3.4.so00b09000      8K rw---  /libdl-2.3.4.so08048000  76968K r-x--  /oracle0cb72000    324K rw---  /oracle0cbc3000    512K rw---    [ anon ]20000000 167936K rw-s-    [ shmid=0x58001 ]b6f56000     36K r-x--  /libnss_files-2.3.4.sob6f5f000      8K rw---  /libnss_files-2.3.4.sob6f75000      4K rw-s-  /hc_test9i.datb6f76000     40K rw---  /zerob6f80000     64K rw---  /zerob6f90000     64K rw---  /zerob6fa0000     64K rw---  /zerob6fb0000    128K rw---  /zerob6fd0000     64K rw---  /zerob6fe0000     64K rw---  /zerob6ff0000     24K rw---  /zerob6ff6000   3048K rw---    [ anon ]b72f0000   1160K r-x--  /libc-2.3.4.sob7412000      4K r----  /libc-2.3.4.sob7413000     12K rw---  /libc-2.3.4.sob7416000      8K rw---    [ anon ]b7418000     56K r-x--  /libpthread-0.10.sob7426000      8K rw---  /libpthread-0.10.sob7428000    268K rw---    [ anon ]b746b000    132K r-x--  /libm-2.3.4.sob748c000      8K rw---  /libm-2.3.4.sob748e000      4K r-x--  /libaio.so.1.0.0b748f000      4K rw---  /libaio.so.1.0.0b74a5000   1904K r-x--  /libnnz10.sob7681000    152K rw---  /libnnz10.sob76a7000      8K rw---    [ anon ]b76a9000     88K r-x--  /libdbcfg10.sob76bf000      8K rw---  /libdbcfg10.sob76c1000     32K r-x--  /libclsra10.sob76c9000      4K rw---  /libclsra10.sob76ca000      4K rw---    [ anon ]b76cb000   7028K r-x--  /libjox10.sob7da8000    260K rw---  /libjox10.sob7de9000      4K rw---    [ anon ]b7dea000    344K r-x--  /libocrutl10.sob7e40000     16K rw---  /libocrutl10.sob7e44000      4K rw---    [ anon ]b7e45000    268K r-x--  /libocrb10.sob7e88000      4K rw---  /libocrb10.sob7e89000    436K r-x--  /libocr10.sob7ef6000      4K rw---  /libocr10.sob7ef7000      4K r-x--  /libskgxn2.sob7ef8000      4K rw---  /libskgxn2.sob7ef9000    880K r-x--  /libhasgen10.sob7fd5000     20K rw---  /libhasgen10.sob7fda000     16K rw---    [ anon ]b7fde000    128K r-x--  /libskgxp10.sob7ffe000      8K rw---  /libskgxp10.sobfffb000     20K rwx--    [ stack ]ffffe000      4K -----    [ anon ] total   262860K了避免多个共享内存段,我们可以修改shmmax内核参数,使SGA存在于一个共享内存段中。修改 /etc/sysctl.conf 加一行kernel.shmmax = 1073741824 reboot system ,then startup database

    实际上,如果没有修改shmmax参数,Oracle在启动过程中就会报出以下错误:Starting ORACLE instance (normal)Thu Nov 17 09:27:29 2005WARNING: EINVAL creating segment of size 0x0000000033400000fix shm parameters in /etc/system or equivalent


    最新回复(0)