file-max设置过小导致oracle数据库hang住

来源:这里教程网 时间:2026-03-03 19:22:08 作者:

服务器上ping报错ping: socket: Too many open files in system [root@rac1 ~]# ping 192.168.238.254 ping: socket: Too many open files in system正常情况下“Too many open files in system”报错都是open files参数设置过小导致。root用户和oracle用户检查,配置正常,如下:[oracle@rac1 ~]$ ulimit -a core file size          (blocks, -c) 0 data seg size           (kbytes, -d) unlimited scheduling priority             (-e) 0 file size               (blocks, -f) unlimited pending signals                 (-i) 64054 max locked memory       (kbytes, -l) 14788901 max memory size         (kbytes, -m) unlimited open files                      (-n) 65536                        <===============配置正常 pipe size            (512 bytes, -p) 8 POSIX message queues     (bytes, -q) 819200 real-time priority              (-r) 0 stack size              (kbytes, -s) unlimited cpu time               (seconds, -t) unlimited max user processes              (-u) 16384 virtual memory          (kbytes, -v) unlimited file locks                      (-x) unlimitedmessage日志报错:Feb  1 20:53:50 rac1 systemd: Looping too fast. Throttling execution a little. Feb  1 20:53:50 rac1 kernel: VFS: file-max limit 790770 reached Feb  1 20:53:51 rac1 kernel: VFS: file-max limit 790770 reached Feb  1 20:53:51 rac1 systemd: Looping too fast. Throttling execution a little. Feb  1 20:53:52 rac1 kernel: VFS: file-max limit 790770 reached Feb  1 20:53:52 rac1 kernel: VFS: file-max limit 790770 reached Feb  1 20:53:53 rac1 systemd: Looping too fast. Throttling execution a little. Feb  1 20:53:53 rac1 kernel: VFS: file-max limit 790770 reached Feb  1 20:53:53 rac1 kernel: VFS: file-max limit 790770 reached Feb  1 20:53:54 rac1 kernel: VFS: file-max limit 790770 reached检查:[root@rac1 ~]# sysctl -a | grep file-max fs.file-max = 790770[root@rac1 ~]# cat /proc/sys/fs/file-nr 2833920    0    790770[root@rac1 ~]# cat /proc/sys/fs/file-nr 2838688    0    790770[root@rac1 ~]# watch -n 1 cat /proc/sys/fs/file-nr2993984    0    790770当前打开的文件总数持续变大,超过了上限的默认值790770修改fs.file-max值的大小:sysctl -w fs.file-max = 6815744或 vi  /etc/sysctl.conf 增加fs.file-max = 6815744sysctl -p生效修改后恢复正常,message异常告警消失。另外:nr_open用于限制单个进程可以分配的最大文件打开数cat /proc/sys/fs/nr_open 1048576 一个进程可以打开的文件数 < hard limit < nr_open,soft limit是告警值,可以超过这个值。file-max操作系统对于文件打开数有一个全局的限制,可以通过/proc/sys/fs/file-max查看。

相关推荐