在从root用户切换到oracle用户时,碰到了ulimit: open files: cannot modify limit: Operation not permitte的提示信息。字面意思

在从root用户切换到Oracle用户时,碰到了ulimit: open files: cannot modify limit: Operation not permitte的提示信息。字面意思来看即是打开文件受到了限制。同一服务器上,,如仅有一个Oracle单实例且数据文件较少的情形应该不会出现该情形。多实例可能会碰到这个情况。由于多个实例都为Oracle用户所有,因此Oracle用户可操作的文件数为所有实例文件数的总和,超出了限制就收到错误提示。

1、故障描述
--在从root切换到oracle时,出现提示
oracle@v2013db02u:/u02/database> su - oracle
Password:
-bash: ulimit: open files: cannot modify limit: Operation not permitted
-bash: ulimit: open files: cannot modify limit: Operation not permitted

a、查看limits.conf配值文件
oracle@v2013db02u:~> more /etc/security/limits.conf
# /etc/security/limits.conf
#
#Each line describes a limit for a user in the form:
#
#
#
#Where:
# can be:
# - an user name
# - a group name, with @group syntax
# - the wildcard *, for default entry
# - the wildcard %, can be also used with %group syntax,
# for maxlogin limit
#
# can have the two values:
# - "soft" for enforcing the soft limits
# - "hard" for enforcing hard limits
#
# can be one of the following:
# - core - limits the core file size (KB)
# - data - max data size (KB)
# - fsize - maximum filesize (KB)
# - memlock - max locked-in-memory address space (KB)
# - nofile - max number of open files
# - rss - max resident set size (KB)
# - stack - max stack size (KB)
# - cpu - max CPU time (MIN)
# - nproc - max number of processes
# - as - address space limit
# - maxlogins - max number of logins for this user
# - maxsyslogins - max number of logins on the system
# - priority - the priority to run user process with
# - locks - max number of file locks the user can hold
# - sigpending - max number of pending signals
# - msgqueue - max memory used by POSIX message queues (bytes)
# - nice - max nice priority allowed to raise to
# - rtprio - max realtime priority
#
#
#

#* soft core 0
#* hard rss 10000
#@student hard nproc 20
#@faculty soft nproc 20
#@faculty hard nproc 50
#ftp hard nproc 0
#@student - maxlogins 4

# End of file

--limits.conf文件的注释信息给出了很好的描述信息,也即是我们可以基于用户或者组来配置soft及hare方面不同的item
--soft即是软限制,hard是硬限制。用户可以超过soft设置的值,但一定不能超过hard 的值。一般soft比hard小
--上面的这个文件中并未为Oracle用户配值任何信息,且通配符*也被注释了
--由于该服务器为一个新的UAT服务器,Oracle software为Infra安装并配置。从上可知,应该是Infra忘记或忽略了配值该文件
--在数据库实例较少且打开的文件数不多的情形则没有任何问题,随着上面运行的实例增大,现象随之出现

--下面查看一下当前用户的资源分配限制
--对于资源限制,也可以使用ulimit 指令,用来限制用户的资源分配,比如打开文件数,最多进程数,CPU的使用时间
--可以使用指令ulimit -a来查看当前用户的各项limit限制(ulimit用法: man ulimit)

b、查看当前用户的资源限制
oracle@v2013db02u:~> ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
pending signals (-i) 540672
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024 -->这里限制了打开的文件数为1024,明显不够
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 16384
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

ulimit: open files: cannot modify limit: Operation not permi-LMLPHP

09-19 12:46