Linux

在 oracle linux 7.5 上編輯 sysctl.conf

  • May 26, 2019

我將在 oracle linux 7.5 上安裝 oracle 數據庫 12c。在此過程中,我必須編輯以下核心參數並設置值。

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586

文件說我應該編輯 /etc/sysctl.conf 文件。當我執行 cat /etc/sysctl.conf 來讀取目前內容時,它會顯示以下消息。

# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.    
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5)

當我嘗試在 vi 中使用 root 使用者進行編輯時,它說 sysctl.conf 是只讀的。即使我用“!”覆蓋,更改也不會應用並修改參數。

除非您手動執行,否則對文件的編輯/etc/sysctl.conf通常只會在重新啟動時影響系統:

sudo sysctl -p

如果要在執行時設置特定的核心變數,請執行以下操作:

sudo sysctl -w kernel.shmmni=4096

如果要查看所有核心變數,請執行以下操作:

sysctl -a

引用自:https://unix.stackexchange.com/questions/447372