下面是几个与Oracle紧密相关的Unix/Linux内核参数,在安装数据库的时候,一般都需要根据实际情况进行调整。
Init.ora Parameter Kernel Parameterdb_block_buffers shmmax, shmall
db_files(maxdatafiles) nfile, maxfiles
large_pool_size shmmax, shmall
log_buffer shmmax, shmall
processes nproc, semmsl, semmns
shared_pool_size
shmmax, shmall
具体参数的说明如下(为避免歧义,这里不做翻译):
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.
shmall - 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).
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.
这里的大部分参数根据oracle官方的安装手册都可以进行正确的设置,但在实际工作中,发现很多DBA对shmmax和shmall这两个参数的设置经常出问题,从而影响数据的整体性能,甚至导致安装失败。
shmmax参数是单个共享内存段的最大值,单位是bytes。这里与oracle的SGA紧密相关,因为SGA使用的就是共享内存段,所以,shmmax>=sga_target,这个参数比较容易设置错误,因为在安装的时候,如果shmmax<sga_target,安装并不会报错,但是,当数据库启动后,SGA会由多个共享内存段组成,而SGA是一个整体,多个共享内存段之间会存在通信,这些通信对于oracle来说是不必要的开销,会导致数据库性能下降。
shmall参数是共享内存页面数的最大值,需要与shmmax参数进行协调设置,shmall>= ceil(shmmax/page_size),其中page_size一般为4k,以具体的操作系统为准。这里要特别注意,shmall的作用域是整个系统范围,而shmmax的作用域是单个共享内存段。因此,如果在一个系统上有多个oracle实例,shmmax设置大于等于最大的sga_target,而shmall需要大于等于所有实例的sga_target之和除以sga_target。这种情况下,如果多个实例已经启动,在添加新实例时,如果shmall参数设置过小,会出现ora-27102 out of memory,导致dbca建库失败。