0

0

cannot set user id: Resource temporarily unavailable

php中文网

php中文网

发布时间:2016-06-07 16:43:43

|

2092人浏览过

|

来源于php中文网

原创

前阵子,Infra报告无法透过putty以及SecureCRT连接到数据库服务器,提示的错误为Resource temporarily unavailable。由于该服务器

前阵子,infra报告无法透过putty以及securecrt连接到数据库服务器,提示的错误为resource temporarily unavailable。由于该服务器上有差不多有20个nstance,应该是超出了系统当前设置的值。关于超出资源限制的事之前有碰到过,只不过不是这个错误,而是open files: cannot modify limit: operation not permitted。下面描述一下关于resource temporarily unavailable这个错误及其相关信息。

一、故障现象

installer@linux_02:~> ps -U Oracle |wc -l

2015

installer@linux_02:~> lsof | grep oracle|wc -l

83646

installer@linux_02:~> su - oracle

Password:

su: cannot set user id: Resource temporarily unavailable

#从Putty或者SecureCRT连接则会出现如下类似的错误:

Server sent disconnect message

type 2(protocol error):

"fork failed: Resource temporarily unavailable"

#系统日志如下:

Aug 19 09:25:01 linux_02 /usr/sbin/cron[6736]: (oracle) MAIL (mailed 25 bytes of output butgot status 0x0001 )

Aug 19 09:26:29 linux_02 sshd[6864]: Accepted keyboard-interactive/pam for oracle from 192.168.9.1 port 1253 ssh2

Aug 19 09:26:29 linux_02 sshd[6875]: fatal: setresuid 2000: Resource temporarily unavailable

Aug 19 09:27:15 linux_02 sshd[6922]: Accepted keyboard-interactive/pam for oracle from 192.168.9.1 port 1312 ssh2

Aug 19 09:27:15 linux_02 sshd[6985]: fatal: setresuid 2000: Resource temporarily unavailable

二、故障分析

#以下是Metalink上788064.1对Resource temporarily unavailable的错误描述:

The error is different when it is reaching the limit 'open files' and 'max user processes' in /etc/profile .

A). Error on reaching the limit 'open files':

[oracle@mydesk~]$ssh rac2

oracle@rac2's password:

-bash: ulimit: max user processes: cannot modify limit: Operation not permitted

-bash: /home/oracle/.bash_profile: Too many open files

B). Error on reaching the limit 'max user processes':

[oracle@mydesk~]$ssh oracle@rac2

oracle@rac2's password:

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

-bash: fork: Resource temporarily unavailable

#也就是说我们当前的错误是由于进程数的限制而引起的 #Author : Leshami

#下面检查当前limits.conf配置 #Blog :

linux_02:/etc/security # grep -v ^# /etc/security/limits.conf

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

#下面是来自SUSE官方的Resolution:

The affected user has reached the maximum number of process specified for him into the file /etc/security/limits.conf .

Cutout.Pro
Cutout.Pro

AI驱动的视觉设计平台

下载

These commands, executed as root, can give you the number of process and of open files for the given user:

ps -U username | wc -l

lsof | grep username | wc -l

To fix the issue increase the NPROC Soft limit according to the user and applications needs; please look at the note below about the /etc/security/limits.conf file.

#上面的描述也是要增加nproc的值,

#从之前的运用的ps以及lsof命令来看,ps命令得到的oracle用户的进程数为2015,从这个值来看,当前的配置符合要求。

#反而是打开文件数超出了设定的hard值,为83682。比较纳闷的是不是文件数错误,而是进程数错误。

#ID 788064.1对此给出的solution 如下:

a). Modify /etc/security/limits.conf manually

Increase the value of 'soft nofile' until it is equal to 'hard nofile' value. Increase the value of 'soft nproc' until it is equal to 'hard nproc' value.

#增加值到soft nofile的值到等于hard nofile的值;增加soft nproc的值到等于hard nproc的值。

#从这个来看的话,,应该是系统一旦启动后会分配soft的值,但是最大值不能超过hard值。不管系统是否空闲,都会分配soft值。

b). Install oracle-validated package to modify /etc/security/limits.conf #安装oracle-validated来自动修改limits.conf(RHEL4 to OL5适用)

After install the oracle-validated package, the content of /etc/security/limits.conf is modified.

#Metalink ID 1239915.1上对此的描述也是要调整limits.conf

SOLUTION

The file /etc/security/limits.conf controls the resource limits for each user.

The nproc value determines how many processes that user is allowed and the nofile value limits the total number of files which may be opened at once.

Increase both the soft and hard limits for the destination user ("oracle" in our example) and save the file.

Activate The Changed User Limits

These changes take effect only upon login, so out and re-login to activate the changes.

三、故障解决

#根据上面的Solution调整limits.conf文件

linux_02:/etc/security # cp limits.conf limits.conf.bk

linux_02:/etc/security # vi /etc/security/limits.conf

linux_02:/etc/security # grep -v ^# /etc/security/limits.conf

oracle soft nproc 16384

oracle hard nproc 16384

oracle soft nofile 65536

oracle hard nofile 65536

oracle@linux_02:/users/oracle> ps -U oracle |wc -l

2714

oracle@linux_02:/users/oracle> lsof | grep oracle|wc -l

110694

四、相关参考

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

DocID: 1239915.1

DocID: 788064.1

本文永久更新链接地址:

linux

热门AI工具

更多
DeepSeek
DeepSeek

幻方量化公司旗下的开源大模型平台

豆包大模型
豆包大模型

字节跳动自主研发的一系列大型语言模型

通义千问
通义千问

阿里巴巴推出的全能AI助手

腾讯元宝
腾讯元宝

腾讯混元平台推出的AI助手

文心一言
文心一言

文心一言是百度开发的AI聊天机器人,通过对话可以生成各种形式的内容。

讯飞写作
讯飞写作

基于讯飞星火大模型的AI写作工具,可以快速生成新闻稿件、品宣文案、工作总结、心得体会等各种文文稿

即梦AI
即梦AI

一站式AI创作平台,免费AI图片和视频生成。

ChatGPT
ChatGPT

最最强大的AI聊天机器人程序,ChatGPT不单是聊天机器人,还能进行撰写邮件、视频脚本、文案、翻译、代码等任务。

相关专题

更多
C++ 设计模式与软件架构
C++ 设计模式与软件架构

本专题深入讲解 C++ 中的常见设计模式与架构优化,包括单例模式、工厂模式、观察者模式、策略模式、命令模式等,结合实际案例展示如何在 C++ 项目中应用这些模式提升代码可维护性与扩展性。通过案例分析,帮助开发者掌握 如何运用设计模式构建高质量的软件架构,提升系统的灵活性与可扩展性。

14

2026.01.30

c++ 字符串格式化
c++ 字符串格式化

本专题整合了c++字符串格式化用法、输出技巧、实践等等内容,阅读专题下面的文章了解更多详细内容。

9

2026.01.30

java 字符串格式化
java 字符串格式化

本专题整合了java如何进行字符串格式化相关教程、使用解析、方法详解等等内容。阅读专题下面的文章了解更多详细教程。

12

2026.01.30

python 字符串格式化
python 字符串格式化

本专题整合了python字符串格式化教程、实践、方法、进阶等等相关内容,阅读专题下面的文章了解更多详细操作。

4

2026.01.30

java入门学习合集
java入门学习合集

本专题整合了java入门学习指南、初学者项目实战、入门到精通等等内容,阅读专题下面的文章了解更多详细学习方法。

20

2026.01.29

java配置环境变量教程合集
java配置环境变量教程合集

本专题整合了java配置环境变量设置、步骤、安装jdk、避免冲突等等相关内容,阅读专题下面的文章了解更多详细操作。

18

2026.01.29

java成品学习网站推荐大全
java成品学习网站推荐大全

本专题整合了java成品网站、在线成品网站源码、源码入口等等相关内容,阅读专题下面的文章了解更多详细推荐内容。

19

2026.01.29

Java字符串处理使用教程合集
Java字符串处理使用教程合集

本专题整合了Java字符串截取、处理、使用、实战等等教程内容,阅读专题下面的文章了解详细操作教程。

3

2026.01.29

Java空对象相关教程合集
Java空对象相关教程合集

本专题整合了Java空对象相关教程,阅读专题下面的文章了解更多详细内容。

6

2026.01.29

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
深入剖析redis教程
深入剖析redis教程

共55课时 | 8.1万人学习

麦子学院深入浅出 redis 视频教程
麦子学院深入浅出 redis 视频教程

共20课时 | 4.5万人学习

传智播客redis基础视频教程
传智播客redis基础视频教程

共13课时 | 5.7万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号