Locations of visitors to this page

Thursday, February 26, 2009

setting kernel parameters for oracle - 设置内核参数

setting kernel parameters for oracle - 设置内核参数



安装oracle前设置shmmax, shmall等内核参数

shmmax表示每个共享内存段的最大字节数
如果Oracle数据库实例SGA的大小大于shmmax, 将会分配多个共享内存段. 为了使整个SGA在同一个共享内存段中分配, 这样貌似性能好些, shmmax应当足够大, 可以设置为大于或等于SGA大小
参考TECH: Unix Semaphores and Shared Memory Explained中Shared memory allocation的介绍

shmall表示系统全局最多可以使用的共享内存的大小, 以页为单位
显然这个参数必须大于SGA, 因为可能其它程序也要用共享内存, 可以设置为等于或接近于物理内存大小
用getconf PAGE_SIZE查看页大小
[root@DEV-Blur-DB-1 ~]# getconf PAGE_SIZE
4096
[root@DEV-Blur-DB-1 ~]#

shmmni系统中最多共享内存段的数量, 缺省值是4096, 对于大多数系统应该够用了


查看目前设置的值
[root@DEV-Blur-DB-1 ~]# cat /proc/sys/kernel/shmmni
4096
[root@DEV-Blur-DB-1 ~]# cat /proc/sys/kernel/shmall
4294967296
[root@DEV-Blur-DB-1 ~]# cat /proc/sys/kernel/shmmax
68719476736

[root@DEV-Blur-DB-1 ~]# ipcs -lm

------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 67108864
max total shared memory (kbytes) = 17179869184
min seg size (bytes) = 1

[root@DEV-Blur-DB-1 ~]# echo $((67108864*1024))



头文件中设置的缺省值
less /usr/include/linux/shm.h
...
/*
 * SHMMAX, SHMMNI and SHMALL are upper limits are defaults which can
 * be increased by sysctl
 */

#define SHMMAX 0x2000000                 /* max shared seg size (bytes) */
#define SHMMIN 1                         /* min shared seg size (bytes) */
#define SHMMNI 4096                      /* max num of segs system wide */
#define SHMALL (SHMMAX/PAGE_SIZE*(SHMMNI/16)) /* max shm system wide (pages) */
#define SHMSEG SHMMNI                    /* max shared segs per process */

...

centos 5.2 中/etc/sysctl.conf重新设置了shmmax, shmall等缺省值, 增加了其大小
less /etc/sysctl.conf
...
# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736

# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296

...
shmmax 64G,shmall 16T, 比物理内存还大很多, 完全满足数据库要求, 不用再修改啦




外部链接:
Tuning and Optimizing Red Hat Enterprise Linux for Oracle 9i and 10g Databases
Installing Oracle Database 10g Release 2 on Linux - (RHEL 5)
linux / unix kernel parameters
Oracle® Database on AIX®,HP-UX®,Linux®,Mac OS® X,Solaris®,Tru64 Unix® Operating Systems Installation and Configuration Requirements Quick Reference (8.0.5 to 11.1)
Linux: How to Check Current Shared Memory, Semaphore Values

TECH: Unix
Semaphores and Shared Memory Explained



Relationship Between Common Init.ora Parameters and Unix Kernel Parameters
maxfiles - Soft file limit per process.
maxuprc - Maximum number of simultaneous user processes per userid.
nfile - Maximum number of simultaneously open files systemwide at any given time.
nproc - Maximum number of processes that can exist simultaneously in the system.
shmmax - The maximum size(in bytes) of a single shared memory segment.
shmmin - The minimum size(in bytes) of a single shared memory segment.
shmmni - The number of shared memory identifiers.
shmseg - The maximum number of shared memory segments that can be attached by a process.
semmns - The number of semaphores in the system.
semmni - The number of semaphore set identifiers in the system; determines the number of semaphore sets that can be created at any one time.
semmsl - The maximum number of sempahores that can be in one semaphore set. It should be same size as maximum number of Oracle processes.

-fin-

No comments:

Website Analytics

Followers