ulimit: open files: cannot modify limit: Operation not permitted

问题描述

-bash: ulimit: open files: cannot modify limit: Operation not permitted

解决方法1:直接修改limits.conf配值文件,且使得永久生效

vim /etc/security/limits.conf

在末尾添加以下内容

smis soft nproc 16384
smis hard nproc 16384
smis soft nofile 65536
smis hard nofile 65536
smis soft memlock 4000000
smis hard memlock 4000000

再次切换到smis用户,未出现之前的错误提示。

配值后建议重启一下服务器。

解决方法2:使用ulimit命令来修改

在使用ulimit命令方式来修改的话,当服务器被重启后会失效(临时性更改)

ulimit 用于限制 shell 启动进程所占用的资源

  • 支持以下各种类型的限制:所创建的内核文件的大小、进程数据块的大小、Shell进程创建文件的大小、内存锁住的大小、常驻内存集的大小
  • 以及打开文件描述符的数量、分配堆栈的最大大小、CPU 时间、单个用户的最大线程数、Shell 进程所能使用的最大虚拟内存
  • 以及支持硬资源和软资源的限制

使用当前用户来修改,即oracle用户,我们将其改为60000

[smis@localhost config]$ ulimit -n 60000

可以看到该资源限制已经被修改

[smis@localhost config]$ ulimit -a | grep "open files" 
open files                      (-n) 60000

但配值文件并未发生任何变化

[smis@localhost config]$ cat /etc/security/limits.conf | grep nofile
smis	soft    nofile  1024
smis	hard    nofile   65536

猜你喜欢

转载自blog.csdn.net/twi_twi/article/details/129766324
今日推荐