免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1052 | 回复: 0
打印 上一主题 下一主题

How do I enable core dumps for everybody [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-09-23 11:53 |只看该作者 |倒序浏览

----------------------------------------------

Overview
In most Linux Distributions core file creation is disabled by default for a normal user. However, it can be necessary to enable this feature for an application (e.g. Oracle). For example, if you encounter an ORA-7445 error in Oracle, then it must be possible to write a core file for the user 玱racle?
To enable writing core files you use the ulimit command, it controls the resources available to a process started by the shell, on systems that allow such control.
If you try to enable writing core files, usually you run in the following problem. Normally SSH is used to logon to the server.
ssh
[email=oracle@ora-server]oracle@ora-server[/email]
$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
pending signals                 (-i) 1024
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 65536
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 16384
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
Now, try (not as user root) to change the core file size to unlimited
$ ulimit -c unlimited
-bash: ulimit: core file size: cannot modify limit: Operation not permitted
Solution
Check Environment for ulimit
The first step is to check, that you don't set ulimit -c 0 in any shell configuration files for this user, for example in $HOME/.bash_profile or $HOME/.bashrc. Uncomment it if you have such an entry.
#
# Do not produce core dumps
#
# ulimit -c 0
  
Globally enable Core Dumps
This must be done as user root, usually in /etc/security/limits.conf
# /etc/security/limits.conf
#
# Each line describes a limit for a user in the form:
#
#   
#
*  soft  core  unlimited
  
Logoff and Logon again and set ulimit
ssh
[email=oracle@ora-server]oracle@ora-server[/email]
$ ulimit -c
0
Try to set the limit as user root first
su -
ulimit -c unlimited
ulimit -c
unlimited
Now you can set ulimit also for user oracle
su - oracle
ulimit -c unlimited
ulimit -c
unlimited
Perhaps the last step number 3 is not necessary, but we have figured out, that this is the way which always work. The core file size limitation is usually also set in different configuration files. If you want to enable cores, you can uncomment them.
In /etc/profile (Redhat)
# No core files by default
# ulimit -S -c 0 > /dev/null 2>&1
In /etc/init.d/functions (Redhat)
# make sure it doesn't core dump anywhere unless requested
# ulimit -S -c ${DAEMON_COREFILE_LIMIT:-0} >/dev/null 2>&1
Now, from this current shell you can generate the core, so check ulimit before.
$ ulimit -a
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
pending signals                 (-i) 1024
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 65536
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 16384
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited



本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/22583/showart_2058239.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP