日期:2012-12-28  浏览次数:20428 次

前几天,在管理系统的时候遇到一个奇怪的问题, 今天才无机会安装好MySQL环境来重现此问题,由于不是最原始的环境, 所以未必能够完全重现, 我只能努力重现关键问题了.. 我觉得此问题有点特别, 故在此大概的回想下当时的情景..

任务时, 执行了一个su – mysql 的命令, 遇到了下面这样一个错误..

view sourceprint?1 [root@dbmain ~]# su - mysql 

2 su: cannot set user id: Resource temporarily unavailable

这是一个Shell中由于资源不足惹起的问题, 当时下认识的先运转ulimit,看看ulimit的基本限制.

view sourceprint?01 [root@dbmain ~]# ulimit -a 

02 core file size          (blocks, -c) 0 

03 data seg size           (kbytes, -d) unlimited 

04 scheduling priority             (-e) 0 

05 file size               (blocks, -f) unlimited 

06 pending signals                 (-i) 25600 

07 max locked memory       (kbytes, -l) 32 

08 max memory size         (kbytes, -m) unlimited 

09 open files                      (-n) 1024 

10 pipe size            (512 bytes, -p) 8 

11 POSIX message queues     (bytes, -q) 819200 

12 real-time priority              (-r) 0 

13 stack size              (kbytes, -s) 10240 

14 cpu time               (seconds, -t) unlimited 

15 max user processes              (-u) 25600 

16 virtual memory          (kbytes, -v) unlimited 

17 file locks                      (-x) unlimited

又看了看,/etc/security/limits.conf

view sourceprint?01 oracle              soft    nproc   2047 

02 oracle              hard    nproc   16384 

03 oracle              soft    nofile  1024 

04 oracle              hard    nofile  65536 

05 oracle              soft    memlock        12582912 

06 oracle              hard   memlock        12582912 

07   

08 grid              soft    nproc   2047 

09 grid              hard    nproc   16384 

10 grid              soft    nofile  1024 

11 grid              hard    nofile  65536 

12 grid       &nb