Search This Blog

Sunday, June 15, 2014

sysctl linux command.

Its more likely you are not aware of this command until you install Oracle DB ;)

Lets look at how to use it .
You may encounter a warning asking you change the kernel parameter. At this point of time you start searching for how to change kernel parameter . 

sysctl is an answer to your query lets stop talking and fire some command. 
(Note : Kernel parameters are not toys to play with so be very careful while dealing with them)

First you need to see the current value of kernel parameter 
You can simple run below command to check the value.
sysctl -a |grep (parameter-name)
e.g
# sysctl -a |grep pid_max
kernel.pid_max = 32768

Once you identify the value its time to change it  .
There are two ways of doing it 
1) temporary ( parameter will only be changed as long as you don't reboot the host)
2) permanent  ( parameter will stay even after reboot)

1) temporary ( parameter will only be changed as long as you don't reboot the host)
Step 1:
Login using root
Step 2:
sysctl -w (parameter-name)=(value)

2) permanent  ( parameter will stay even after reboot)
Step 1:
Login using root
Step 2:
take a backup of /etc/sysctl.conf
#cp /etc/sysctl.conf /etc/sysctl.conf.bkp.16jun2014
Step 3: 
now check if the parameter you want to change is in the file or not 
#cat /etc/sysctl.conf |grep (parameter-name)
If it exists then change it or else add an entry at the bottom of the file.(using text editors like vi )
Step 4:
once you edit the file fire below command so that parameters will be reinitialized. 
#sysctl -p