目录标题
关于 ORA-27300、ORA-27301、ORA-27302 错误,这类错误属于 Oracle 数据库启动或运行过程中与操作系统资源相关的问题,尤其与 进程创建、系统限制、资源配额(如 nproc) 有关。以下是详细的排查思路和解决方案:
🔍 一、错误说明
这些错误常同时出现,如:
ORA-27300: OS system dependent operation:fork failed with status: 11
ORA-27301: OS failure message: Resource temporarily unavailable
ORA-27302: failure occurred at: sskgmsmr_internal
对应含义:
-
ORA-27300:系统依赖的操作失败(如
fork()),附带错误码。 -
ORA-27301:OS 返回的错误信息,常见为:
Resource temporarily unavailableNot enough space
-
ORA-27302:具体哪个 Oracle 内部函数出错,比如
sskgmsmr_internal、skgpspawn,sskgpcrea, 等。
🔧 二、常见原因及排查方向
✅ 1. 进程数限制(ulimit -u / nproc)
Oracle 使用 fork() 创建子进程,如果 当前用户可用的进程数已达上限,则会报错。
➤ 排查方法:
ulimit -u # 当前 shell 用户最大进程数限制(soft limit)
ulimit -a # 查看所有限制
ps -u oracle | wc -l
➤ 默认值:
- RHEL / CentOS 7/8/9 上
nproc默认是 4096,如果未修改配置文件。 - 可以通过以下文件查看默认限制:
cat /etc/security/limits.d/20-nproc.conf
如默认条目:
* soft nproc 4096
这表示所有用户(*)的 soft nproc 限制是 4096。
✅ 2. pam_limits.so 未生效
即使配置了 /etc/security/limits.conf,如果 PAM 没启用 limits 模块,限制不会生效。
➤ 检查:
grep pam_limits /etc/pam.d/login
确保有以下一行:
session required pam_limits.so
✅ 3. /etc/security/limits.conf 或 profile 设置不合理
配置举例:
oracle soft nproc 16384
oracle hard nproc 65536
oracle soft nofile 1024
oracle hard nofile 65536
你可以使用 /etc/security/limits.d/oracle.conf 来做单独用户配置。
✅ 4. ulimit 设置未生效(bash 启动脚本)
在 .bash_profile、.profile、.bashrc 中设置的 ulimit 可能未被服务启动脚本读取。
使用 ps e -u oracle 或者从 systemd 配置中确认是否继承了正确的限制。
✅ 5. 查看 dmesg/kern log(系统内核日志)
dmesg | grep -i fork
journalctl -xe | grep -i fork
如看到:
fork: Resource temporarily unavailable
或:
cgroup: fork rejected by pids controller
说明是内核控制组(如 cgroup)限制了进程数。
✅ 6. cgroup 或 systemd 限制(CentOS 7+/RHEL)
systemd 可能限制进程数,查看服务配置文件:
cat /etc/systemd/system/oracle.service
确认是否有:
LimitNPROC=65536
LimitNOFILE=65536
或使用:
systemctl show oracle | grep -i limit
✅ 三、解决方案汇总
| 项目 | 说明 |
|---|---|
ulimit -u | 建议设置大于 16384 |
/etc/security/limits.conf | 配置 oracle 用户的 nproc 和 nofile |
/etc/systemd/system/oracle.service | 添加 LimitNPROC 和 LimitNOFILE |
/etc/pam.d/login | 确保包含 pam_limits.so |
| 检查 cgroup | 有时容器或 systemd cgroup 限制了 fork |
🧪 示例:最佳实践配置
/etc/security/limits.d/oracle.conf
oracle soft nproc 16384
oracle hard nproc 65536
oracle soft nofile 10240
oracle hard nofile 65536
/etc/systemd/system/oracle.service
[Service]
LimitNPROC=65536
LimitNOFILE=65536
重载 systemd 并重启服务:
systemctl daemon-reexec
systemctl daemon-reload
systemctl restart oracle
📌 小结
| 问题来源 | 是否默认 4096 | 建议值 |
|---|---|---|
| nproc(进程数)限制 | 是,未配置时多数发行版为 4096 | soft=16384,hard=65536 |
| pam_limits 模块未生效 | N/A | 加入 pam 限制模块 |
| systemd / cgroup 限制 | 否 | 配置 LimitNPROC |
| cgroup pids 限制 | 否 | 检查 pids.max 配额 |
如需,我可以提供自动化脚本来统一检查和设置这些参数。需要吗?
1305

被折叠的 条评论
为什么被折叠?



