打开/etc/sysctl.conf 文件,将下列数据写入到sysctl.conf的末尾并保存:
kernel.shmmax = 536870912 #单个共享内存段的最大值一般为RAM的一半
kernel.shmmni = 4096 #控制共享内存段总数
kernel.shmall = 2097152 #控制共享内存页数
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
echo "kernel.shmmax=130433024" >> /etc/sysctl.conf #512M的内存大小
echo "kernel.shmmni=4096" >> /etc/sysctl.conf
echo "kernel.shmall=2097152" >> /etc/sysctl.conf
echo "kernel.sem=250 32000 100 128" >> /etc/sysctl.conf
echo "fs.file-max=65536" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range=1024 65000" >> /etc/sysctl.conf
完成后,运行以下命令激活更改:
/sbin/sysctl –p
以 root 用户身份运行以下命令来验证您的设置:
/sbin/sysctl -a | grep shm
/sbin/sysctl -a | grep sem
/sbin/sysctl -a | grep file-max
/sbin/sysctl -a | grep ip_local_port_range
Setting SHMMAX Parametershmmax内核参数定义单个共享内存段的最大值,如果该参数设置小于Oracle SGA设置,那么SGA就会被分配多个共享内存段。这在繁忙的系统中可能成为性能负担,带来系统问题。
参照ORACLE 官方的最近解释(Doc ID: 567506.1 )
Oracle Global Customer Support officially recommends a " maximum" for SHMMAX of just less than 4Gb, or 4294967295
To see all shared memory segments that are allocated on the system, execute:
$ ipcs -m
Setting SHMALL Parameter
This parameter sets the total amount of shared memory pages that can be used system wide. Hence, SHMALL should always be at least ceil(shmmax/PAGE_SIZE).
If you are not sure what the default PAGE_SIZE is on your Linux system, you can run the following command:
$ getconf PAGE_SIZE
To determine the system wide maximum number of shared memory pages, run:
# cat /proc/sys/kernel/shmall
Setting SHMMNI Parameter
This parameter sets the system wide maximum number of shared memory segments.
Oracle recommends SHMMNI to be at least 4096 for Oracle 10g. For Oracle 9i on x86 the recommended minimum setting is lower. Since these recommendations are minimum settings, it's best to set it always to at least 4096 for 9i and 10g databases on x86 and x86-64 platforms.
To determine the system wide maximum number of shared memory segments, run:
# cat /proc/sys/kernel/shmmni
kernel.sem = 250 32000 100 128 参数的意义
These values represent SEMMSL, SEMMNS, SEMOPM, and SEMMNI.
The SEMMSL Parameter
This parameter defines the maximum number of semaphores per semaphore set.
Oracle recommends SEMMSL to be at least 250 for 9i R2 and 10g R1/R2 databases except for 9i R2 on x86 platforms where the minimum value is lower.
Note what Metalink Note:187405.1 and Note:184821.1 have to say regarding SEMMSL: "The SEMMSL setting should be 10 plus the largest PROCESSES parameter of any Oracle database on the system
This parameter defines the total number of semaphores (not semaphore sets) for the entire Linux system.
Oracle recommends SEMMSL to be at least 32000 for 9i R2 and 10g R1/R2 databases except for 9i R2 on x86 platforms where the minimum value is lower. Setting SEMMNS to 32000 ensures that SEMMSL * SEMMNI (250*128=32000) semaphores can be be used. Therefore it's recommended to set SEMMNS to at least 32000 for 9i and 10g databases on x86 and x86-64 platforms.
SEMMNS不应该大于SEMMSL * SEMMNI值
The SEMOPM Parameter
This parameter defines the maximum number of semaphore operations that can be performed per semop(2) system call (semaphore call).
Since a semaphore set can have the maximum number of SEMMSL semaphores per semaphore set, it is often recommended to set SEMOPM equal to SEMMSL.
Oracle recommends to set SEMOPM to a minimum value of 100 for 9i R2 and 10g R1/R2 databases on x86 and x86-64 platforms.
The SEMMNI Parameter
This parameter defines the maximum number of semaphore sets for the entire Linux system.
Oracle recommends SEMMNI to be at least 128 for 9i R2 and 10g R1/R2 databases except for 9i R2 on x86 platforms where the minimum value is lower
To determine the values of the four described semaphore parameters, run:
# cat /proc/sys/kernel/sem
250 32000 32 128
These values represent SEMMSL, SEMMNS, SEMOPM, and SEMMNI.
Alternatively, you can run:
# ipcs -ls
All four described semaphore parameters can be changed in the proc file system without reboot:
Setting File HandlesThe maximum number of file handles specifies the maximum number of open files on a Linux system.
Oracle recommends that the file handles for the entire system is set to at least 65536 for 9i R2 and 10g R1/2 for x86 and x86-64 platforms
To determine the maximum number of file handles for the entire system, run:
cat /proc/sys/fs/file-max
To determine the current usage of file handles, run:
$ cat /proc/sys/fs/file-nr
1154 133 8192
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/22782597/viewspace-618291/ ,如需转载,请注明出处,否则将追究法律责任。