在linux上安装oracle时的limit设定

oracle 10g database在linux安装时,设定oracle用户limit时:为何在pam模组里面添加了limit限制然后又要在login shell里面修改呢,这样相互的设定会被影响。经过测试login shell的设定会覆盖pam模组的设定


以下是询问oracle support的结果

 The simple way to adjust resource limits is to set the same hard/soft limit only in /etc/security/limits.conf and ignore /etc/profile; This is the recommended way, used by oracle-validated as well. 

In some notes, ie Note 419646.1 and Note 421308.1 ,there is another procedure to set resource limits for the user "oracle". 
Normally, when a user logs in, /etc/security/limits.conf is first loaded by the PAM module pam_limits, and then login shell does the initialization from /etc/profile . 
In the notes, first set the different soft/hard values for the oracle user, in /etc/security/limits.conf: 
# cat /etc/security/limits.conf 
... 
oracle soft nproc 2047 
oracle hard nproc 16384 
oracle soft nofile 1024 
oracle hard nofile 65536 

Once you set the hard limits in this example, the maximum open files are 65536, and the maximum user processes are 16384, you can not increase the hard limit threshold value any more from /etc/profile. But, you may raise soft limit to the maximum value(hard) in /etc/profile: 
# cat /etc/profile 
... 
if [ $USER = "oracle" ]; then 
ulimit -u 16384 
ulimit -n 65536 
fi 

In this case, the soft & hard limits are the same finally. 

You need notice two points if setting different soft/hard limit: 
1. If you have set different soft/hard values in /etc/security/limits.conf and /etc/profile, upon the oracle user login, the user's initial nofile/nproc limit value in the /etc/security/limits.conf, is overrwritten by the /etc/profile script. 
2. /etc/profile is only invoked for the login shell. For any non-login shell, the setting in /etc/profile, are skipped. 


版权声明:本文为loryliu原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。