資料庫的效能最佳化涉及到整個資料庫運行環境的方方面面,諸如作業系統,Oracle自身,儲存,網路等等幾個大塊。而作業系統則是Oracle穩定運行與最大化效能的基石。本文主要描述基於Linux系統下 Oracle 核心參數的配置。
校正下面的列表中顯示的核心參數的值被設定為大於或等於下面所顯示的最小值。
如果你的系統中下面的任意參數的當前值已經大於或高於下面列出的值,請不要做任何修改。
下面的步驟給出了如何去校正並設定這些參數的值。
通過執行下面的命令進行校正
/sbin/sysctl -a | egrep "kernel.shmall|kernel.shmmax|kernel.shmmn|kernel.sem"
然後比較下表所列出的值
注意:下表顯示的是核心參數以及shell 限制所需的最小值。對於生產資料庫,Oracle建議去調整這些值使得資料庫效能達到最優。有關最佳化核心參數更多資訊請參考作業系統相關文檔。
Oracle 核心參數參考值
Parameter |
Minimum Value |
Recommended value |
File |
semmsl semmns semopm semmni |
250 32000 100 128 |
Set only if those that are set by OS or other applications are lower |
/proc/sys/kernel/sem |
shmall |
2097152 |
shmmax/page_size usually page_size=4 |
/proc/sys/kernel/shmall |
shmmax |
Minimum of the following values: · Half the size of the memory · 4GB - 1 byte Note: The minimum value required for shmmax is 0.5 GB. However, Oracle recommends that you set the value of shmmax to 2.0 GB for optimum performance of the system. |
Half of RAM or if swap file is less then half of RAM the size of swap file |
/proc/sys/kernel/shmmax |
shmmni |
4096 |
/proc/sys/kernel/shmmni |
file-max |
512 * PROCESSES |
/proc/sys/fs/file-max |
ip_local_port_range |
Minimum:9000 Maximum: 65000 |
/proc/sys/net/ipv4/ip_local_port_range |
rmem_default |
262144 |
/proc/sys/net/core/rmem_default |
rmem_max |
4194304 |
/proc/sys/net/core/rmem_max |
wmem_default |
262144 |
/proc/sys/net/core/wmem_default |
wmem_max |
1048576 |
/proc/sys/net/core/wmem_max |
tcp_wmem |
262144 |
/proc/sys/net/ipv4/tcp_wmem |
tcp_rmem |
4194304 |
/proc/sys/net/ipv4/tcp_rmem |
校正核心參數
按照下面的步驟去查看指定參數的值,如果有必要的話對其進行修改
執行下表中相應的命令來顯示這些核心參數的值,並標記該參數的值是否需要修改。
Parameter |
Command |
semmsl, semmns, semopm, and semmni |
# /sbin/sysctl -a | grep sem This command displays the value of the semaphore parameters in the order listed. |
shmall, shmmax, and shmmni |
# /sbin/sysctl -a | grep shm This command displays the details of the shared memory segment sizes. |
file-max |
# /sbin/sysctl -a | grep file-max This command displays the maximum number of file handles. |
ip_local_port_range |
# /sbin/sysctl -a | grep ip_local_port_range This command displays a range of port numbers. |
rmem_default |
# /sbin/sysctl -a | grep rmem_default |
rmem_max |
# /sbin/sysctl -a | grep rmem_max |
wmem_default |
# /sbin/sysctl -a | grep wmem_default |
wmem_max |
# /sbin/sysctl -a | grep wmem_max |
tcp_wmem |
# /sbin/sysctl -a | grep tcp_wmem |
tcp_rmem |
# /sbin/sysctl -a | grep tcp_rmem |