Friday, September 12, 2008

set ulimit permanently on Solaris, AIX and Linux

set ulimit permanently:-

default ulimit looks like this
#ulimit -a
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 10
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 29995
virtual memory (kbytes, -v) unlimited



On Solaris:
edit /etc/system with following entries

set rlim_fd_max = 4096 # Hard limit on file descriptors for a single proc
##(Without this above condition, the default value for nofiles is half of the rlim_fd_cur)
set rlim_fd_cur = 1024 # Soft limit on file descriptors for a single proc

On AIX:

etc/security/limits
- you can configure ulimits for each user here

esaadmin:
stack = 393216
stack_hard = 393216


On Linux:
/etc/security/limits.conf
- you can configure ulimits for each user here



username hard nofile 4096
username soft nofile 63536

Hard and soft limits of 4096 for 'nofile' (all users)
* soft nofile 4096
* hard nofile 4096


The "soft limit" in the first line defines the number of file handles or open files that the

user will have after login.
If the Oracle gets error messages about running out of file handles, then the user can increase

the number of file handles like in this example up to 63536 ("hard limit") by executing the

following command:

ulimit -n 63536

You can set the "soft" and "hard" limits higher if necessary.

Do not set the "hard" limit for nofile for the user equal to /proc/sys/fs/file-max. If you do

that and the user uses up all the file handles, then the entire system will run out of file

handles. This could mean that you won't be able to initiate new logins any more since the system

won't be able to open any PAM modules that are required for the login process. That's why I set

the hard limit to 63536 and not 65536.

Imp: you have to reboot the server after these changes

2 comments:

Unknown said...

Hi Pankaj,

We are running Solaris 10 and we tried the method you described for solaris here. But after the reboot, the output of ulimit -a still has the default value 256. Do you know what we are missing here?

Thanks,
Larry

Pankaj Gautam said...

what's yr max set for open files? By default it show whatever you have set it as yr soft limit.

for example if yr max is 1024
You can manually set it as below
# ulimit -n 1024